node-api/docker/docker_test.go

29 lines
542 B
Go
Raw Normal View History

2022-02-03 00:31:47 +00:00
package docker
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetProcesses(t *testing.T) {
driver := Driver{
BindIPHTTP: "127.0.0.1",
BindIPSSH: "127.0.0.1",
}
driver.Remove("test")
_, err := driver.Create("test", "docker.io/library/busybox", "/tmp", 8990, 8922, 1, 128, []string{"sleep", "3600"})
assert.Nil(t, err)
err = driver.Start("test")
assert.Nil(t, err)
processes, err := driver.GetProcesses("test")
assert.Nil(t, err)
assert.Contains(t, processes, "sleep 3600")
driver.Remove("test")
}