Merge pull request #19612 from Microsoft/jjh/apicontainerstest
Windows CI: Fixup docker_api_containers_test.go
This commit is contained in:
commit
3cf4884787
1 changed files with 90 additions and 47 deletions
|
@ -24,8 +24,15 @@ import (
|
|||
"github.com/go-check/check"
|
||||
)
|
||||
|
||||
var sleepCmd = "/bin/sleep"
|
||||
|
||||
func init() {
|
||||
if daemonPlatform == "windows" {
|
||||
sleepCmd = "sleep"
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiGetAll(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
startCount, err := getContainerCount()
|
||||
c.Assert(err, checker.IsNil, check.Commentf("Cannot query container count"))
|
||||
|
||||
|
@ -50,7 +57,6 @@ func (s *DockerSuite) TestContainerApiGetAll(c *check.C) {
|
|||
|
||||
// regression test for empty json field being omitted #13691
|
||||
func (s *DockerSuite) TestContainerApiGetJSONNoFieldsOmitted(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "busybox", "true")
|
||||
|
||||
status, body, err := sockRequest("GET", "/containers/json?all=1", nil)
|
||||
|
@ -87,11 +93,12 @@ type containerPs struct {
|
|||
}
|
||||
|
||||
// regression test for non-empty fields from #13901
|
||||
func (s *DockerSuite) TestContainerPsOmitFields(c *check.C) {
|
||||
func (s *DockerSuite) TestContainerApiPsOmitFields(c *check.C) {
|
||||
// Problematic for Windows porting due to networking not yet being passed back
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "pstest"
|
||||
port := 80
|
||||
dockerCmd(c, "run", "-d", "--name", name, "--expose", strconv.Itoa(port), "busybox", "top")
|
||||
dockerCmd(c, "run", "-d", "--name", name, "--expose", strconv.Itoa(port), "busybox", sleepCmd, "60")
|
||||
|
||||
status, body, err := sockRequest("GET", "/containers/json?all=1", nil)
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -120,6 +127,7 @@ func (s *DockerSuite) TestContainerPsOmitFields(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiGetExport(c *check.C) {
|
||||
// TODO: Investigate why this fails on Windows to Windows CI
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "exportcontainer"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test")
|
||||
|
@ -143,6 +151,7 @@ func (s *DockerSuite) TestContainerApiGetExport(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiGetChanges(c *check.C) {
|
||||
// Not supported on Windows as Windows does not support docker diff (/containers/name/changes)
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "changescontainer"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "rm", "/etc/passwd")
|
||||
|
@ -168,11 +177,16 @@ func (s *DockerSuite) TestContainerApiGetChanges(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiStartVolumeBinds(c *check.C) {
|
||||
// TODO Windows CI: Investigate further why this fails on Windows to Windows CI.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
path := "/foo"
|
||||
if daemonPlatform == "windows" {
|
||||
path = `c:\foo`
|
||||
}
|
||||
name := "testing"
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
"Volumes": map[string]struct{}{"/tmp": {}},
|
||||
"Volumes": map[string]struct{}{path: {}},
|
||||
}
|
||||
|
||||
status, _, err := sockRequest("POST", "/containers/create?name="+name, config)
|
||||
|
@ -181,19 +195,20 @@ func (s *DockerSuite) TestContainerApiStartVolumeBinds(c *check.C) {
|
|||
|
||||
bindPath := randomTmpDirPath("test", daemonPlatform)
|
||||
config = map[string]interface{}{
|
||||
"Binds": []string{bindPath + ":/tmp"},
|
||||
"Binds": []string{bindPath + ":" + path},
|
||||
}
|
||||
status, _, err = sockRequest("POST", "/containers/"+name+"/start", config)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(status, checker.Equals, http.StatusNoContent)
|
||||
|
||||
pth, err := inspectMountSourceField(name, "/tmp")
|
||||
pth, err := inspectMountSourceField(name, path)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(pth, checker.Equals, bindPath, check.Commentf("expected volume host path to be %s, got %s", bindPath, pth))
|
||||
}
|
||||
|
||||
// Test for GH#10618
|
||||
func (s *DockerSuite) TestContainerApiStartDupVolumeBinds(c *check.C) {
|
||||
// TODO Windows to Windows CI - Port this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testdups"
|
||||
config := map[string]interface{}{
|
||||
|
@ -218,6 +233,7 @@ func (s *DockerSuite) TestContainerApiStartDupVolumeBinds(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiStartVolumesFrom(c *check.C) {
|
||||
// TODO Windows to Windows CI - Port this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
volName := "voltst"
|
||||
volPath := "/tmp"
|
||||
|
@ -249,6 +265,7 @@ func (s *DockerSuite) TestContainerApiStartVolumesFrom(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestGetContainerStats(c *check.C) {
|
||||
// Problematic on Windows as Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
var (
|
||||
name = "statscontainer"
|
||||
|
@ -287,6 +304,7 @@ func (s *DockerSuite) TestGetContainerStats(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
|
||||
// Problematic on Windows as Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -327,6 +345,7 @@ func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
|
|||
// previous test was just checking one stat entry so it didn't fail (stats with
|
||||
// stream false always return one stat)
|
||||
func (s *DockerSuite) TestGetContainerStatsStream(c *check.C) {
|
||||
// Problematic on Windows as Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "statscontainer"
|
||||
dockerCmd(c, "run", "-d", "--name", name, "busybox", "top")
|
||||
|
@ -364,6 +383,7 @@ func (s *DockerSuite) TestGetContainerStatsStream(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestGetContainerStatsNoStream(c *check.C) {
|
||||
// Problematic on Windows as Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "statscontainer"
|
||||
dockerCmd(c, "run", "-d", "--name", name, "busybox", "top")
|
||||
|
@ -399,6 +419,7 @@ func (s *DockerSuite) TestGetContainerStatsNoStream(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) {
|
||||
// Problematic on Windows as Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// TODO: this test does nothing because we are c.Assert'ing in goroutine
|
||||
var (
|
||||
|
@ -420,6 +441,7 @@ func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) {
|
|||
|
||||
// #9981 - Allow a docker created volume (ie, one in /var/lib/docker/volumes) to be used to overwrite (via passing in Binds on api start) an existing volume
|
||||
func (s *DockerSuite) TestPostContainerBindNormalVolume(c *check.C) {
|
||||
// TODO Windows to Windows CI - Port this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "create", "-v", "/foo", "--name=one", "busybox")
|
||||
|
||||
|
@ -439,6 +461,7 @@ func (s *DockerSuite) TestPostContainerBindNormalVolume(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiPause(c *check.C) {
|
||||
// Problematic on Windows as Windows does not support pause
|
||||
testRequires(c, DaemonIsLinux)
|
||||
defer unpauseAllContainers()
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "sleep", "30")
|
||||
|
@ -465,6 +488,7 @@ func (s *DockerSuite) TestContainerApiPause(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiTop(c *check.C) {
|
||||
// Problematic on Windows as Windows does not support top
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "top")
|
||||
id := strings.TrimSpace(string(out))
|
||||
|
@ -490,7 +514,6 @@ func (s *DockerSuite) TestContainerApiTop(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
cName := "testapicommit"
|
||||
dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
|
||||
|
||||
|
@ -514,7 +537,6 @@ func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
cName := "testapicommitwithconfig"
|
||||
dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
|
||||
|
||||
|
@ -550,6 +572,7 @@ func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiBadPort(c *check.C) {
|
||||
// TODO Windows to Windows CI - Port this test
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
|
@ -574,7 +597,6 @@ func (s *DockerSuite) TestContainerApiBadPort(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCreate(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
"Cmd": []string{"/bin/sh", "-c", "touch /test && ls /test"},
|
||||
|
@ -629,6 +651,7 @@ func (s *DockerSuite) TestContainerApiCreateMultipleNetworksConfig(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCreateWithHostName(c *check.C) {
|
||||
// TODO Windows: Port this test once hostname is supported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
hostName := "test-host"
|
||||
config := map[string]interface{}{
|
||||
|
@ -653,6 +676,7 @@ func (s *DockerSuite) TestContainerApiCreateWithHostName(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCreateWithDomainName(c *check.C) {
|
||||
// TODO Windows: Port this test once domain name is supported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
domainName := "test-domain"
|
||||
config := map[string]interface{}{
|
||||
|
@ -677,11 +701,13 @@ func (s *DockerSuite) TestContainerApiCreateWithDomainName(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCreateBridgeNetworkMode(c *check.C) {
|
||||
// Windows does not support bridge
|
||||
testRequires(c, DaemonIsLinux)
|
||||
UtilCreateNetworkMode(c, "bridge")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCreateOtherNetworkModes(c *check.C) {
|
||||
// Windows does not support these network modes
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
UtilCreateNetworkMode(c, "host")
|
||||
UtilCreateNetworkMode(c, "container:web1")
|
||||
|
@ -710,6 +736,7 @@ func UtilCreateNetworkMode(c *check.C, networkMode string) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCreateWithCpuSharesCpuset(c *check.C) {
|
||||
// TODO Windows to Windows CI. The CpuShares part could be ported.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
|
@ -742,7 +769,6 @@ func (s *DockerSuite) TestContainerApiCreateWithCpuSharesCpuset(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiVerifyHeader(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
}
|
||||
|
@ -774,10 +800,10 @@ func (s *DockerSuite) TestContainerApiVerifyHeader(c *check.C) {
|
|||
|
||||
//Issue 14230. daemon should return 500 for invalid port syntax
|
||||
func (s *DockerSuite) TestContainerApiInvalidPortSyntax(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := `{
|
||||
"Image": "busybox",
|
||||
"HostConfig": {
|
||||
"NetworkMode": "default",
|
||||
"PortBindings": {
|
||||
"19039;1230": [
|
||||
{}
|
||||
|
@ -798,6 +824,8 @@ func (s *DockerSuite) TestContainerApiInvalidPortSyntax(c *check.C) {
|
|||
// Issue 7941 - test to make sure a "null" in JSON is just ignored.
|
||||
// W/o this fix a null in JSON would be parsed into a string var as "null"
|
||||
func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
|
||||
// TODO Windows to Windows CI. Bit of this with alternate fields checked
|
||||
// can probably be ported.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := `{
|
||||
"Hostname":"",
|
||||
|
@ -833,7 +861,6 @@ func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
|
|||
}
|
||||
var container createResp
|
||||
c.Assert(json.Unmarshal(b, &container), checker.IsNil)
|
||||
|
||||
out, err := inspectField(container.ID, "HostConfig.CpusetCpus")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Equals, "")
|
||||
|
@ -847,6 +874,7 @@ func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) {
|
||||
// TODO Windows: Port once memory is supported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := `{
|
||||
"Image": "busybox",
|
||||
|
@ -866,6 +894,7 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestStartWithTooLowMemoryLimit(c *check.C) {
|
||||
// TODO Windows: Port once memory is supported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "create", "busybox")
|
||||
|
||||
|
@ -885,6 +914,7 @@ func (s *DockerSuite) TestStartWithTooLowMemoryLimit(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiRename(c *check.C) {
|
||||
// TODO Windows: Enable for TP5. Fails on TP4.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "--name", "TestContainerApiRename", "-d", "busybox", "sh")
|
||||
|
||||
|
@ -900,9 +930,8 @@ func (s *DockerSuite) TestContainerApiRename(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiKill(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-api-kill"
|
||||
dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
|
||||
dockerCmd(c, "run", "-di", "--name", name, "busybox", sleepCmd, "60")
|
||||
|
||||
status, _, err := sockRequest("POST", "/containers/"+name+"/kill", nil)
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -914,6 +943,7 @@ func (s *DockerSuite) TestContainerApiKill(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiRestart(c *check.C) {
|
||||
// TODO Windows to Windows CI. This is flaky due to the timing
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-api-restart"
|
||||
dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
|
||||
|
@ -925,6 +955,7 @@ func (s *DockerSuite) TestContainerApiRestart(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiRestartNotimeoutParam(c *check.C) {
|
||||
// TODO Windows to Windows CI. This is flaky due to the timing
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-api-restart-no-timeout-param"
|
||||
out, _ := dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
|
||||
|
@ -938,11 +969,10 @@ func (s *DockerSuite) TestContainerApiRestartNotimeoutParam(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiStart(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testing-start"
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
"Cmd": []string{"/bin/sh", "-c", "/bin/top"},
|
||||
"Cmd": []string{"/bin/sh", "-c", sleepCmd, "60"},
|
||||
"OpenStdin": true,
|
||||
}
|
||||
|
||||
|
@ -962,30 +992,28 @@ func (s *DockerSuite) TestContainerApiStart(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiStop(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-api-stop"
|
||||
dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
|
||||
dockerCmd(c, "run", "-di", "--name", name, "busybox", sleepCmd, "60")
|
||||
|
||||
status, _, err := sockRequest("POST", "/containers/"+name+"/stop?t=1", nil)
|
||||
status, _, err := sockRequest("POST", "/containers/"+name+"/stop?t=30", nil)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(status, checker.Equals, http.StatusNoContent)
|
||||
c.Assert(waitInspect(name, "{{ .State.Running }}", "false", 5*time.Second), checker.IsNil)
|
||||
c.Assert(waitInspect(name, "{{ .State.Running }}", "false", 60*time.Second), checker.IsNil)
|
||||
|
||||
// second call to start should give 304
|
||||
status, _, err = sockRequest("POST", "/containers/"+name+"/stop?t=1", nil)
|
||||
status, _, err = sockRequest("POST", "/containers/"+name+"/stop?t=30", nil)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(status, checker.Equals, http.StatusNotModified)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiWait(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-api-wait"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "sleep", "5")
|
||||
dockerCmd(c, "run", "--name", name, "busybox", sleepCmd, "5")
|
||||
|
||||
status, body, err := sockRequest("POST", "/containers/"+name+"/wait", nil)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(status, checker.Equals, http.StatusOK)
|
||||
c.Assert(waitInspect(name, "{{ .State.Running }}", "false", 5*time.Second), checker.IsNil)
|
||||
c.Assert(waitInspect(name, "{{ .State.Running }}", "false", 60*time.Second), checker.IsNil)
|
||||
|
||||
var waitres types.ContainerWaitResponse
|
||||
c.Assert(json.Unmarshal(body, &waitres), checker.IsNil)
|
||||
|
@ -993,6 +1021,7 @@ func (s *DockerSuite) TestContainerApiWait(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCopy(c *check.C) {
|
||||
// TODO Windows to Windows CI. This can be ported.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-container-api-copy"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
|
@ -1023,6 +1052,7 @@ func (s *DockerSuite) TestContainerApiCopy(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCopyResourcePathEmpty(c *check.C) {
|
||||
// TODO Windows to Windows CI. This can be ported.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-container-api-copy-resource-empty"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
|
@ -1038,6 +1068,7 @@ func (s *DockerSuite) TestContainerApiCopyResourcePathEmpty(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCopyResourcePathNotFound(c *check.C) {
|
||||
// TODO Windows to Windows CI. This can be ported.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-container-api-copy-resource-not-found"
|
||||
dockerCmd(c, "run", "--name", name, "busybox")
|
||||
|
@ -1063,8 +1094,7 @@ func (s *DockerSuite) TestContainerApiCopyContainerNotFound(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiDelete(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", sleepCmd, "60")
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(id), checker.IsNil)
|
||||
|
@ -1084,8 +1114,7 @@ func (s *DockerSuite) TestContainerApiDeleteNotExist(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiDeleteForce(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", sleepCmd, "60")
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(id), checker.IsNil)
|
||||
|
@ -1096,6 +1125,7 @@ func (s *DockerSuite) TestContainerApiDeleteForce(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiDeleteRemoveLinks(c *check.C) {
|
||||
// Windows does not support links
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "--name", "tlink1", "busybox", "top")
|
||||
|
||||
|
@ -1121,8 +1151,7 @@ func (s *DockerSuite) TestContainerApiDeleteRemoveLinks(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiDeleteConflict(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", sleepCmd, "60")
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(id), checker.IsNil)
|
||||
|
@ -1133,15 +1162,19 @@ func (s *DockerSuite) TestContainerApiDeleteConflict(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiDeleteRemoveVolume(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, SameHostDaemon)
|
||||
|
||||
out, _ := dockerCmd(c, "run", "-d", "-v", "/testvolume", "busybox", "top")
|
||||
vol := "/testvolume"
|
||||
if daemonPlatform == "windows" {
|
||||
vol = `c:\testvolume`
|
||||
}
|
||||
|
||||
out, _ := dockerCmd(c, "run", "-d", "-v", vol, "busybox", sleepCmd, "60")
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(id), checker.IsNil)
|
||||
|
||||
source, err := inspectMountSourceField(id, "/testvolume")
|
||||
source, err := inspectMountSourceField(id, vol)
|
||||
_, err = os.Stat(source)
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
|
@ -1153,7 +1186,8 @@ func (s *DockerSuite) TestContainerApiDeleteRemoveVolume(c *check.C) {
|
|||
}
|
||||
|
||||
// Regression test for https://github.com/docker/docker/issues/6231
|
||||
func (s *DockerSuite) TestContainersApiChunkedEncoding(c *check.C) {
|
||||
func (s *DockerSuite) TestContainerApiChunkedEncoding(c *check.C) {
|
||||
// TODO Windows CI: This can be ported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "create", "-v", "/foo", "busybox", "true")
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -1188,9 +1222,8 @@ func (s *DockerSuite) TestContainersApiChunkedEncoding(c *check.C) {
|
|||
c.Assert(binds[0], checker.Equals, expected, check.Commentf("got incorrect bind spec"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainerStop(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
func (s *DockerSuite) TestContainerApiPostContainerStop(c *check.C) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", sleepCmd, "60")
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(containerID), checker.IsNil)
|
||||
|
@ -1203,8 +1236,7 @@ func (s *DockerSuite) TestPostContainerStop(c *check.C) {
|
|||
}
|
||||
|
||||
// #14170
|
||||
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceEntrypoint(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
func (s *DockerSuite) TestPostContainerApiCreateWithStringOrSliceEntrypoint(c *check.C) {
|
||||
config := struct {
|
||||
Image string
|
||||
Entrypoint string
|
||||
|
@ -1228,7 +1260,6 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceEntrypoint(c *che
|
|||
|
||||
// #14170
|
||||
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := struct {
|
||||
Image string
|
||||
Entrypoint string
|
||||
|
@ -1251,6 +1282,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *check.C) {
|
|||
|
||||
// regression #14318
|
||||
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *check.C) {
|
||||
// Windows doesn't support CapAdd/CapDrop
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := struct {
|
||||
Image string
|
||||
|
@ -1273,9 +1305,11 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *che
|
|||
|
||||
// #14640
|
||||
func (s *DockerSuite) TestPostContainersStartWithoutLinksInHostConfig(c *check.C) {
|
||||
// TODO Windows: Windows doesn't support supplying a hostconfig on start.
|
||||
// An alternate test could be written to validate the negative testing aspect of this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-host-config-links"
|
||||
dockerCmd(c, "create", "--name", name, "busybox", "top")
|
||||
dockerCmd(c, "create", "--name", name, "busybox", sleepCmd, "60")
|
||||
|
||||
hc, err := inspectFieldJSON(name, "HostConfig")
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -1289,6 +1323,8 @@ func (s *DockerSuite) TestPostContainersStartWithoutLinksInHostConfig(c *check.C
|
|||
|
||||
// #14640
|
||||
func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfig(c *check.C) {
|
||||
// TODO Windows: Windows doesn't support supplying a hostconfig on start.
|
||||
// An alternate test could be written to validate the negative testing aspect of this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-host-config-links"
|
||||
dockerCmd(c, "run", "--name", "foo", "-d", "busybox", "top")
|
||||
|
@ -1306,6 +1342,7 @@ func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfig(c *check.C) {
|
|||
|
||||
// #14640
|
||||
func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfigIdLinked(c *check.C) {
|
||||
// Windows does not support links
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-host-config-links"
|
||||
out, _ := dockerCmd(c, "run", "--name", "link0", "-d", "busybox", "top")
|
||||
|
@ -1323,8 +1360,7 @@ func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfigIdLinked(c *ch
|
|||
}
|
||||
|
||||
// #14915
|
||||
func (s *DockerSuite) TestContainersApiCreateNoHostConfig118(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
func (s *DockerSuite) TestContainerApiCreateNoHostConfig118(c *check.C) {
|
||||
config := struct {
|
||||
Image string
|
||||
}{"busybox"}
|
||||
|
@ -1337,6 +1373,7 @@ func (s *DockerSuite) TestContainersApiCreateNoHostConfig118(c *check.C) {
|
|||
// extract an archive to a symlink in a writable volume which points to a
|
||||
// directory outside of the volume.
|
||||
func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(c *check.C) {
|
||||
// Windows does not support read-only rootfs
|
||||
// Requires local volume mount bind.
|
||||
// --read-only + userns has remount issues
|
||||
testRequires(c, SameHostDaemon, NotUserNamespace, DaemonIsLinux)
|
||||
|
@ -1367,9 +1404,7 @@ func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainersApiGetContainersJSONEmpty(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
func (s *DockerSuite) TestContainerApiGetContainersJSONEmpty(c *check.C) {
|
||||
status, body, err := sockRequest("GET", "/containers/json?all=1", nil)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(status, checker.Equals, http.StatusOK)
|
||||
|
@ -1377,6 +1412,7 @@ func (s *DockerSuite) TestContainersApiGetContainersJSONEmpty(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C) {
|
||||
// Not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
c1 := struct {
|
||||
|
@ -1403,6 +1439,7 @@ func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C)
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestStartWithNilDNS(c *check.C) {
|
||||
// TODO Windows: Add once DNS is supported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "create", "busybox")
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
@ -1420,6 +1457,7 @@ func (s *DockerSuite) TestStartWithNilDNS(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) {
|
||||
// ShmSize is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
|
@ -1433,6 +1471,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check.C) {
|
||||
// ShmSize is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
var defaultSHMSize int64 = 67108864
|
||||
config := map[string]interface{}{
|
||||
|
@ -1464,6 +1503,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check.
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) {
|
||||
// ShmSize is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
|
@ -1495,6 +1535,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) {
|
||||
// ShmSize is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
|
@ -1526,6 +1567,7 @@ func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(c *check.C) {
|
||||
// Swappiness is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
|
@ -1550,6 +1592,7 @@ func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(
|
|||
|
||||
// check validation is done daemon side and not only in cli
|
||||
func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *check.C) {
|
||||
// OomScoreAdj is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
config := struct {
|
||||
|
|
Loading…
Reference in a new issue