mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Windows CI: Fix api_containers_test.go
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
bf85a49509
commit
2b0a742237
1 changed files with 90 additions and 47 deletions
|
@ -23,8 +23,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"))
|
||||
|
||||
|
@ -49,7 +56,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)
|
||||
|
@ -86,11 +92,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)
|
||||
|
@ -119,6 +126,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")
|
||||
|
@ -142,6 +150,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")
|
||||
|
@ -167,11 +176,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)
|
||||
|
@ -180,19 +194,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{}{
|
||||
|
@ -217,6 +232,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"
|
||||
|
@ -248,6 +264,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"
|
||||
|
@ -286,6 +303,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)
|
||||
|
@ -326,6 +344,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")
|
||||
|
@ -363,6 +382,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")
|
||||
|
@ -398,6 +418,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 (
|
||||
|
@ -419,6 +440,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")
|
||||
|
||||
|
@ -438,6 +460,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")
|
||||
|
@ -464,6 +487,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))
|
||||
|
@ -489,7 +513,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")
|
||||
|
||||
|
@ -513,7 +536,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")
|
||||
|
||||
|
@ -549,6 +571,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",
|
||||
|
@ -573,7 +596,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"},
|
||||
|
@ -605,6 +627,7 @@ func (s *DockerSuite) TestContainerApiCreateEmptyConfig(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{}{
|
||||
|
@ -629,6 +652,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{}{
|
||||
|
@ -653,11 +677,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")
|
||||
|
@ -686,6 +712,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",
|
||||
|
@ -718,7 +745,6 @@ func (s *DockerSuite) TestContainerApiCreateWithCpuSharesCpuset(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiVerifyHeader(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
}
|
||||
|
@ -750,10 +776,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": [
|
||||
{}
|
||||
|
@ -774,6 +800,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":"",
|
||||
|
@ -809,7 +837,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, "")
|
||||
|
@ -823,6 +850,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",
|
||||
|
@ -842,6 +870,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")
|
||||
|
||||
|
@ -861,6 +890,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")
|
||||
|
||||
|
@ -876,9 +906,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)
|
||||
|
@ -890,6 +919,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")
|
||||
|
@ -901,6 +931,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")
|
||||
|
@ -914,11 +945,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,
|
||||
}
|
||||
|
||||
|
@ -938,30 +968,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)
|
||||
|
@ -969,6 +997,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")
|
||||
|
@ -999,6 +1028,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")
|
||||
|
@ -1014,6 +1044,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")
|
||||
|
@ -1039,8 +1070,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)
|
||||
|
@ -1060,8 +1090,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)
|
||||
|
@ -1072,6 +1101,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")
|
||||
|
||||
|
@ -1097,8 +1127,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)
|
||||
|
@ -1109,15 +1138,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)
|
||||
|
||||
|
@ -1129,7 +1162,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)
|
||||
|
@ -1164,9 +1198,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)
|
||||
|
@ -1179,8 +1212,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
|
||||
|
@ -1204,7 +1236,6 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceEntrypoint(c *che
|
|||
|
||||
// #14170
|
||||
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := struct {
|
||||
Image string
|
||||
Entrypoint string
|
||||
|
@ -1227,6 +1258,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
|
||||
|
@ -1249,9 +1281,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)
|
||||
|
@ -1265,6 +1299,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")
|
||||
|
@ -1282,6 +1318,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")
|
||||
|
@ -1299,8 +1336,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"}
|
||||
|
@ -1313,6 +1349,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)
|
||||
|
@ -1343,9 +1380,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)
|
||||
|
@ -1353,6 +1388,7 @@ func (s *DockerSuite) TestContainersApiGetContainersJSONEmpty(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C) {
|
||||
// Not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
c1 := struct {
|
||||
|
@ -1379,6 +1415,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)
|
||||
|
@ -1396,6 +1433,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",
|
||||
|
@ -1409,6 +1447,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{}{
|
||||
|
@ -1440,6 +1479,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",
|
||||
|
@ -1471,6 +1511,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",
|
||||
|
@ -1502,6 +1543,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",
|
||||
|
@ -1526,6 +1568,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