Windows CI: Fixup docker_api_containers_test.go
| ... | ... |
@@ -24,8 +24,15 @@ import ( |
| 24 | 24 |
"github.com/go-check/check" |
| 25 | 25 |
) |
| 26 | 26 |
|
| 27 |
+var sleepCmd = "/bin/sleep" |
|
| 28 |
+ |
|
| 29 |
+func init() {
|
|
| 30 |
+ if daemonPlatform == "windows" {
|
|
| 31 |
+ sleepCmd = "sleep" |
|
| 32 |
+ } |
|
| 33 |
+} |
|
| 34 |
+ |
|
| 27 | 35 |
func (s *DockerSuite) TestContainerApiGetAll(c *check.C) {
|
| 28 |
- testRequires(c, DaemonIsLinux) |
|
| 29 | 36 |
startCount, err := getContainerCount() |
| 30 | 37 |
c.Assert(err, checker.IsNil, check.Commentf("Cannot query container count"))
|
| 31 | 38 |
|
| ... | ... |
@@ -50,7 +57,6 @@ func (s *DockerSuite) TestContainerApiGetAll(c *check.C) {
|
| 50 | 50 |
|
| 51 | 51 |
// regression test for empty json field being omitted #13691 |
| 52 | 52 |
func (s *DockerSuite) TestContainerApiGetJSONNoFieldsOmitted(c *check.C) {
|
| 53 |
- testRequires(c, DaemonIsLinux) |
|
| 54 | 53 |
dockerCmd(c, "run", "busybox", "true") |
| 55 | 54 |
|
| 56 | 55 |
status, body, err := sockRequest("GET", "/containers/json?all=1", nil)
|
| ... | ... |
@@ -87,11 +93,12 @@ type containerPs struct {
|
| 87 | 87 |
} |
| 88 | 88 |
|
| 89 | 89 |
// regression test for non-empty fields from #13901 |
| 90 |
-func (s *DockerSuite) TestContainerPsOmitFields(c *check.C) {
|
|
| 90 |
+func (s *DockerSuite) TestContainerApiPsOmitFields(c *check.C) {
|
|
| 91 |
+ // Problematic for Windows porting due to networking not yet being passed back |
|
| 91 | 92 |
testRequires(c, DaemonIsLinux) |
| 92 | 93 |
name := "pstest" |
| 93 | 94 |
port := 80 |
| 94 |
- dockerCmd(c, "run", "-d", "--name", name, "--expose", strconv.Itoa(port), "busybox", "top") |
|
| 95 |
+ dockerCmd(c, "run", "-d", "--name", name, "--expose", strconv.Itoa(port), "busybox", sleepCmd, "60") |
|
| 95 | 96 |
|
| 96 | 97 |
status, body, err := sockRequest("GET", "/containers/json?all=1", nil)
|
| 97 | 98 |
c.Assert(err, checker.IsNil) |
| ... | ... |
@@ -120,6 +127,7 @@ func (s *DockerSuite) TestContainerPsOmitFields(c *check.C) {
|
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 | 122 |
func (s *DockerSuite) TestContainerApiGetExport(c *check.C) {
|
| 123 |
+ // TODO: Investigate why this fails on Windows to Windows CI |
|
| 123 | 124 |
testRequires(c, DaemonIsLinux) |
| 124 | 125 |
name := "exportcontainer" |
| 125 | 126 |
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test") |
| ... | ... |
@@ -143,6 +151,7 @@ func (s *DockerSuite) TestContainerApiGetExport(c *check.C) {
|
| 143 | 143 |
} |
| 144 | 144 |
|
| 145 | 145 |
func (s *DockerSuite) TestContainerApiGetChanges(c *check.C) {
|
| 146 |
+ // Not supported on Windows as Windows does not support docker diff (/containers/name/changes) |
|
| 146 | 147 |
testRequires(c, DaemonIsLinux) |
| 147 | 148 |
name := "changescontainer" |
| 148 | 149 |
dockerCmd(c, "run", "--name", name, "busybox", "rm", "/etc/passwd") |
| ... | ... |
@@ -168,11 +177,16 @@ func (s *DockerSuite) TestContainerApiGetChanges(c *check.C) {
|
| 168 | 168 |
} |
| 169 | 169 |
|
| 170 | 170 |
func (s *DockerSuite) TestContainerApiStartVolumeBinds(c *check.C) {
|
| 171 |
+ // TODO Windows CI: Investigate further why this fails on Windows to Windows CI. |
|
| 171 | 172 |
testRequires(c, DaemonIsLinux) |
| 173 |
+ path := "/foo" |
|
| 174 |
+ if daemonPlatform == "windows" {
|
|
| 175 |
+ path = `c:\foo` |
|
| 176 |
+ } |
|
| 172 | 177 |
name := "testing" |
| 173 | 178 |
config := map[string]interface{}{
|
| 174 | 179 |
"Image": "busybox", |
| 175 |
- "Volumes": map[string]struct{}{"/tmp": {}},
|
|
| 180 |
+ "Volumes": map[string]struct{}{path: {}},
|
|
| 176 | 181 |
} |
| 177 | 182 |
|
| 178 | 183 |
status, _, err := sockRequest("POST", "/containers/create?name="+name, config)
|
| ... | ... |
@@ -181,19 +195,20 @@ func (s *DockerSuite) TestContainerApiStartVolumeBinds(c *check.C) {
|
| 181 | 181 |
|
| 182 | 182 |
bindPath := randomTmpDirPath("test", daemonPlatform)
|
| 183 | 183 |
config = map[string]interface{}{
|
| 184 |
- "Binds": []string{bindPath + ":/tmp"},
|
|
| 184 |
+ "Binds": []string{bindPath + ":" + path},
|
|
| 185 | 185 |
} |
| 186 | 186 |
status, _, err = sockRequest("POST", "/containers/"+name+"/start", config)
|
| 187 | 187 |
c.Assert(err, checker.IsNil) |
| 188 | 188 |
c.Assert(status, checker.Equals, http.StatusNoContent) |
| 189 | 189 |
|
| 190 |
- pth, err := inspectMountSourceField(name, "/tmp") |
|
| 190 |
+ pth, err := inspectMountSourceField(name, path) |
|
| 191 | 191 |
c.Assert(err, checker.IsNil) |
| 192 | 192 |
c.Assert(pth, checker.Equals, bindPath, check.Commentf("expected volume host path to be %s, got %s", bindPath, pth))
|
| 193 | 193 |
} |
| 194 | 194 |
|
| 195 | 195 |
// Test for GH#10618 |
| 196 | 196 |
func (s *DockerSuite) TestContainerApiStartDupVolumeBinds(c *check.C) {
|
| 197 |
+ // TODO Windows to Windows CI - Port this |
|
| 197 | 198 |
testRequires(c, DaemonIsLinux) |
| 198 | 199 |
name := "testdups" |
| 199 | 200 |
config := map[string]interface{}{
|
| ... | ... |
@@ -218,6 +233,7 @@ func (s *DockerSuite) TestContainerApiStartDupVolumeBinds(c *check.C) {
|
| 218 | 218 |
} |
| 219 | 219 |
|
| 220 | 220 |
func (s *DockerSuite) TestContainerApiStartVolumesFrom(c *check.C) {
|
| 221 |
+ // TODO Windows to Windows CI - Port this |
|
| 221 | 222 |
testRequires(c, DaemonIsLinux) |
| 222 | 223 |
volName := "voltst" |
| 223 | 224 |
volPath := "/tmp" |
| ... | ... |
@@ -249,6 +265,7 @@ func (s *DockerSuite) TestContainerApiStartVolumesFrom(c *check.C) {
|
| 249 | 249 |
} |
| 250 | 250 |
|
| 251 | 251 |
func (s *DockerSuite) TestGetContainerStats(c *check.C) {
|
| 252 |
+ // Problematic on Windows as Windows does not support stats |
|
| 252 | 253 |
testRequires(c, DaemonIsLinux) |
| 253 | 254 |
var ( |
| 254 | 255 |
name = "statscontainer" |
| ... | ... |
@@ -287,6 +304,7 @@ func (s *DockerSuite) TestGetContainerStats(c *check.C) {
|
| 287 | 287 |
} |
| 288 | 288 |
|
| 289 | 289 |
func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
|
| 290 |
+ // Problematic on Windows as Windows does not support stats |
|
| 290 | 291 |
testRequires(c, DaemonIsLinux) |
| 291 | 292 |
out, _ := dockerCmd(c, "run", "-d", "busybox", "top") |
| 292 | 293 |
id := strings.TrimSpace(out) |
| ... | ... |
@@ -327,6 +345,7 @@ func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
|
| 327 | 327 |
// previous test was just checking one stat entry so it didn't fail (stats with |
| 328 | 328 |
// stream false always return one stat) |
| 329 | 329 |
func (s *DockerSuite) TestGetContainerStatsStream(c *check.C) {
|
| 330 |
+ // Problematic on Windows as Windows does not support stats |
|
| 330 | 331 |
testRequires(c, DaemonIsLinux) |
| 331 | 332 |
name := "statscontainer" |
| 332 | 333 |
dockerCmd(c, "run", "-d", "--name", name, "busybox", "top") |
| ... | ... |
@@ -364,6 +383,7 @@ func (s *DockerSuite) TestGetContainerStatsStream(c *check.C) {
|
| 364 | 364 |
} |
| 365 | 365 |
|
| 366 | 366 |
func (s *DockerSuite) TestGetContainerStatsNoStream(c *check.C) {
|
| 367 |
+ // Problematic on Windows as Windows does not support stats |
|
| 367 | 368 |
testRequires(c, DaemonIsLinux) |
| 368 | 369 |
name := "statscontainer" |
| 369 | 370 |
dockerCmd(c, "run", "-d", "--name", name, "busybox", "top") |
| ... | ... |
@@ -399,6 +419,7 @@ func (s *DockerSuite) TestGetContainerStatsNoStream(c *check.C) {
|
| 399 | 399 |
} |
| 400 | 400 |
|
| 401 | 401 |
func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) {
|
| 402 |
+ // Problematic on Windows as Windows does not support stats |
|
| 402 | 403 |
testRequires(c, DaemonIsLinux) |
| 403 | 404 |
// TODO: this test does nothing because we are c.Assert'ing in goroutine |
| 404 | 405 |
var ( |
| ... | ... |
@@ -420,6 +441,7 @@ func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) {
|
| 420 | 420 |
|
| 421 | 421 |
// #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 |
| 422 | 422 |
func (s *DockerSuite) TestPostContainerBindNormalVolume(c *check.C) {
|
| 423 |
+ // TODO Windows to Windows CI - Port this |
|
| 423 | 424 |
testRequires(c, DaemonIsLinux) |
| 424 | 425 |
dockerCmd(c, "create", "-v", "/foo", "--name=one", "busybox") |
| 425 | 426 |
|
| ... | ... |
@@ -439,6 +461,7 @@ func (s *DockerSuite) TestPostContainerBindNormalVolume(c *check.C) {
|
| 439 | 439 |
} |
| 440 | 440 |
|
| 441 | 441 |
func (s *DockerSuite) TestContainerApiPause(c *check.C) {
|
| 442 |
+ // Problematic on Windows as Windows does not support pause |
|
| 442 | 443 |
testRequires(c, DaemonIsLinux) |
| 443 | 444 |
defer unpauseAllContainers() |
| 444 | 445 |
out, _ := dockerCmd(c, "run", "-d", "busybox", "sleep", "30") |
| ... | ... |
@@ -465,6 +488,7 @@ func (s *DockerSuite) TestContainerApiPause(c *check.C) {
|
| 465 | 465 |
} |
| 466 | 466 |
|
| 467 | 467 |
func (s *DockerSuite) TestContainerApiTop(c *check.C) {
|
| 468 |
+ // Problematic on Windows as Windows does not support top |
|
| 468 | 469 |
testRequires(c, DaemonIsLinux) |
| 469 | 470 |
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "top") |
| 470 | 471 |
id := strings.TrimSpace(string(out)) |
| ... | ... |
@@ -490,7 +514,6 @@ func (s *DockerSuite) TestContainerApiTop(c *check.C) {
|
| 490 | 490 |
} |
| 491 | 491 |
|
| 492 | 492 |
func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
|
| 493 |
- testRequires(c, DaemonIsLinux) |
|
| 494 | 493 |
cName := "testapicommit" |
| 495 | 494 |
dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test") |
| 496 | 495 |
|
| ... | ... |
@@ -514,7 +537,6 @@ func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
|
| 514 | 514 |
} |
| 515 | 515 |
|
| 516 | 516 |
func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
|
| 517 |
- testRequires(c, DaemonIsLinux) |
|
| 518 | 517 |
cName := "testapicommitwithconfig" |
| 519 | 518 |
dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test") |
| 520 | 519 |
|
| ... | ... |
@@ -550,6 +572,7 @@ func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
|
| 550 | 550 |
} |
| 551 | 551 |
|
| 552 | 552 |
func (s *DockerSuite) TestContainerApiBadPort(c *check.C) {
|
| 553 |
+ // TODO Windows to Windows CI - Port this test |
|
| 553 | 554 |
testRequires(c, DaemonIsLinux) |
| 554 | 555 |
config := map[string]interface{}{
|
| 555 | 556 |
"Image": "busybox", |
| ... | ... |
@@ -574,7 +597,6 @@ func (s *DockerSuite) TestContainerApiBadPort(c *check.C) {
|
| 574 | 574 |
} |
| 575 | 575 |
|
| 576 | 576 |
func (s *DockerSuite) TestContainerApiCreate(c *check.C) {
|
| 577 |
- testRequires(c, DaemonIsLinux) |
|
| 578 | 577 |
config := map[string]interface{}{
|
| 579 | 578 |
"Image": "busybox", |
| 580 | 579 |
"Cmd": []string{"/bin/sh", "-c", "touch /test && ls /test"},
|
| ... | ... |
@@ -629,6 +651,7 @@ func (s *DockerSuite) TestContainerApiCreateMultipleNetworksConfig(c *check.C) {
|
| 629 | 629 |
} |
| 630 | 630 |
|
| 631 | 631 |
func (s *DockerSuite) TestContainerApiCreateWithHostName(c *check.C) {
|
| 632 |
+ // TODO Windows: Port this test once hostname is supported |
|
| 632 | 633 |
testRequires(c, DaemonIsLinux) |
| 633 | 634 |
hostName := "test-host" |
| 634 | 635 |
config := map[string]interface{}{
|
| ... | ... |
@@ -653,6 +676,7 @@ func (s *DockerSuite) TestContainerApiCreateWithHostName(c *check.C) {
|
| 653 | 653 |
} |
| 654 | 654 |
|
| 655 | 655 |
func (s *DockerSuite) TestContainerApiCreateWithDomainName(c *check.C) {
|
| 656 |
+ // TODO Windows: Port this test once domain name is supported |
|
| 656 | 657 |
testRequires(c, DaemonIsLinux) |
| 657 | 658 |
domainName := "test-domain" |
| 658 | 659 |
config := map[string]interface{}{
|
| ... | ... |
@@ -677,11 +701,13 @@ func (s *DockerSuite) TestContainerApiCreateWithDomainName(c *check.C) {
|
| 677 | 677 |
} |
| 678 | 678 |
|
| 679 | 679 |
func (s *DockerSuite) TestContainerApiCreateBridgeNetworkMode(c *check.C) {
|
| 680 |
+ // Windows does not support bridge |
|
| 680 | 681 |
testRequires(c, DaemonIsLinux) |
| 681 | 682 |
UtilCreateNetworkMode(c, "bridge") |
| 682 | 683 |
} |
| 683 | 684 |
|
| 684 | 685 |
func (s *DockerSuite) TestContainerApiCreateOtherNetworkModes(c *check.C) {
|
| 686 |
+ // Windows does not support these network modes |
|
| 685 | 687 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 686 | 688 |
UtilCreateNetworkMode(c, "host") |
| 687 | 689 |
UtilCreateNetworkMode(c, "container:web1") |
| ... | ... |
@@ -710,6 +736,7 @@ func UtilCreateNetworkMode(c *check.C, networkMode string) {
|
| 710 | 710 |
} |
| 711 | 711 |
|
| 712 | 712 |
func (s *DockerSuite) TestContainerApiCreateWithCpuSharesCpuset(c *check.C) {
|
| 713 |
+ // TODO Windows to Windows CI. The CpuShares part could be ported. |
|
| 713 | 714 |
testRequires(c, DaemonIsLinux) |
| 714 | 715 |
config := map[string]interface{}{
|
| 715 | 716 |
"Image": "busybox", |
| ... | ... |
@@ -742,7 +769,6 @@ func (s *DockerSuite) TestContainerApiCreateWithCpuSharesCpuset(c *check.C) {
|
| 742 | 742 |
} |
| 743 | 743 |
|
| 744 | 744 |
func (s *DockerSuite) TestContainerApiVerifyHeader(c *check.C) {
|
| 745 |
- testRequires(c, DaemonIsLinux) |
|
| 746 | 745 |
config := map[string]interface{}{
|
| 747 | 746 |
"Image": "busybox", |
| 748 | 747 |
} |
| ... | ... |
@@ -774,10 +800,10 @@ func (s *DockerSuite) TestContainerApiVerifyHeader(c *check.C) {
|
| 774 | 774 |
|
| 775 | 775 |
//Issue 14230. daemon should return 500 for invalid port syntax |
| 776 | 776 |
func (s *DockerSuite) TestContainerApiInvalidPortSyntax(c *check.C) {
|
| 777 |
- testRequires(c, DaemonIsLinux) |
|
| 778 | 777 |
config := `{
|
| 779 | 778 |
"Image": "busybox", |
| 780 | 779 |
"HostConfig": {
|
| 780 |
+ "NetworkMode": "default", |
|
| 781 | 781 |
"PortBindings": {
|
| 782 | 782 |
"19039;1230": [ |
| 783 | 783 |
{}
|
| ... | ... |
@@ -798,6 +824,8 @@ func (s *DockerSuite) TestContainerApiInvalidPortSyntax(c *check.C) {
|
| 798 | 798 |
// Issue 7941 - test to make sure a "null" in JSON is just ignored. |
| 799 | 799 |
// W/o this fix a null in JSON would be parsed into a string var as "null" |
| 800 | 800 |
func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
|
| 801 |
+ // TODO Windows to Windows CI. Bit of this with alternate fields checked |
|
| 802 |
+ // can probably be ported. |
|
| 801 | 803 |
testRequires(c, DaemonIsLinux) |
| 802 | 804 |
config := `{
|
| 803 | 805 |
"Hostname":"", |
| ... | ... |
@@ -833,7 +861,6 @@ func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
|
| 833 | 833 |
} |
| 834 | 834 |
var container createResp |
| 835 | 835 |
c.Assert(json.Unmarshal(b, &container), checker.IsNil) |
| 836 |
- |
|
| 837 | 836 |
out, err := inspectField(container.ID, "HostConfig.CpusetCpus") |
| 838 | 837 |
c.Assert(err, checker.IsNil) |
| 839 | 838 |
c.Assert(out, checker.Equals, "") |
| ... | ... |
@@ -847,6 +874,7 @@ func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
|
| 847 | 847 |
} |
| 848 | 848 |
|
| 849 | 849 |
func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) {
|
| 850 |
+ // TODO Windows: Port once memory is supported |
|
| 850 | 851 |
testRequires(c, DaemonIsLinux) |
| 851 | 852 |
config := `{
|
| 852 | 853 |
"Image": "busybox", |
| ... | ... |
@@ -866,6 +894,7 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) {
|
| 866 | 866 |
} |
| 867 | 867 |
|
| 868 | 868 |
func (s *DockerSuite) TestStartWithTooLowMemoryLimit(c *check.C) {
|
| 869 |
+ // TODO Windows: Port once memory is supported |
|
| 869 | 870 |
testRequires(c, DaemonIsLinux) |
| 870 | 871 |
out, _ := dockerCmd(c, "create", "busybox") |
| 871 | 872 |
|
| ... | ... |
@@ -885,6 +914,7 @@ func (s *DockerSuite) TestStartWithTooLowMemoryLimit(c *check.C) {
|
| 885 | 885 |
} |
| 886 | 886 |
|
| 887 | 887 |
func (s *DockerSuite) TestContainerApiRename(c *check.C) {
|
| 888 |
+ // TODO Windows: Enable for TP5. Fails on TP4. |
|
| 888 | 889 |
testRequires(c, DaemonIsLinux) |
| 889 | 890 |
out, _ := dockerCmd(c, "run", "--name", "TestContainerApiRename", "-d", "busybox", "sh") |
| 890 | 891 |
|
| ... | ... |
@@ -900,9 +930,8 @@ func (s *DockerSuite) TestContainerApiRename(c *check.C) {
|
| 900 | 900 |
} |
| 901 | 901 |
|
| 902 | 902 |
func (s *DockerSuite) TestContainerApiKill(c *check.C) {
|
| 903 |
- testRequires(c, DaemonIsLinux) |
|
| 904 | 903 |
name := "test-api-kill" |
| 905 |
- dockerCmd(c, "run", "-di", "--name", name, "busybox", "top") |
|
| 904 |
+ dockerCmd(c, "run", "-di", "--name", name, "busybox", sleepCmd, "60") |
|
| 906 | 905 |
|
| 907 | 906 |
status, _, err := sockRequest("POST", "/containers/"+name+"/kill", nil)
|
| 908 | 907 |
c.Assert(err, checker.IsNil) |
| ... | ... |
@@ -914,6 +943,7 @@ func (s *DockerSuite) TestContainerApiKill(c *check.C) {
|
| 914 | 914 |
} |
| 915 | 915 |
|
| 916 | 916 |
func (s *DockerSuite) TestContainerApiRestart(c *check.C) {
|
| 917 |
+ // TODO Windows to Windows CI. This is flaky due to the timing |
|
| 917 | 918 |
testRequires(c, DaemonIsLinux) |
| 918 | 919 |
name := "test-api-restart" |
| 919 | 920 |
dockerCmd(c, "run", "-di", "--name", name, "busybox", "top") |
| ... | ... |
@@ -925,6 +955,7 @@ func (s *DockerSuite) TestContainerApiRestart(c *check.C) {
|
| 925 | 925 |
} |
| 926 | 926 |
|
| 927 | 927 |
func (s *DockerSuite) TestContainerApiRestartNotimeoutParam(c *check.C) {
|
| 928 |
+ // TODO Windows to Windows CI. This is flaky due to the timing |
|
| 928 | 929 |
testRequires(c, DaemonIsLinux) |
| 929 | 930 |
name := "test-api-restart-no-timeout-param" |
| 930 | 931 |
out, _ := dockerCmd(c, "run", "-di", "--name", name, "busybox", "top") |
| ... | ... |
@@ -938,11 +969,10 @@ func (s *DockerSuite) TestContainerApiRestartNotimeoutParam(c *check.C) {
|
| 938 | 938 |
} |
| 939 | 939 |
|
| 940 | 940 |
func (s *DockerSuite) TestContainerApiStart(c *check.C) {
|
| 941 |
- testRequires(c, DaemonIsLinux) |
|
| 942 | 941 |
name := "testing-start" |
| 943 | 942 |
config := map[string]interface{}{
|
| 944 | 943 |
"Image": "busybox", |
| 945 |
- "Cmd": []string{"/bin/sh", "-c", "/bin/top"},
|
|
| 944 |
+ "Cmd": []string{"/bin/sh", "-c", sleepCmd, "60"},
|
|
| 946 | 945 |
"OpenStdin": true, |
| 947 | 946 |
} |
| 948 | 947 |
|
| ... | ... |
@@ -962,30 +992,28 @@ func (s *DockerSuite) TestContainerApiStart(c *check.C) {
|
| 962 | 962 |
} |
| 963 | 963 |
|
| 964 | 964 |
func (s *DockerSuite) TestContainerApiStop(c *check.C) {
|
| 965 |
- testRequires(c, DaemonIsLinux) |
|
| 966 | 965 |
name := "test-api-stop" |
| 967 |
- dockerCmd(c, "run", "-di", "--name", name, "busybox", "top") |
|
| 966 |
+ dockerCmd(c, "run", "-di", "--name", name, "busybox", sleepCmd, "60") |
|
| 968 | 967 |
|
| 969 |
- status, _, err := sockRequest("POST", "/containers/"+name+"/stop?t=1", nil)
|
|
| 968 |
+ status, _, err := sockRequest("POST", "/containers/"+name+"/stop?t=30", nil)
|
|
| 970 | 969 |
c.Assert(err, checker.IsNil) |
| 971 | 970 |
c.Assert(status, checker.Equals, http.StatusNoContent) |
| 972 |
- c.Assert(waitInspect(name, "{{ .State.Running }}", "false", 5*time.Second), checker.IsNil)
|
|
| 971 |
+ c.Assert(waitInspect(name, "{{ .State.Running }}", "false", 60*time.Second), checker.IsNil)
|
|
| 973 | 972 |
|
| 974 | 973 |
// second call to start should give 304 |
| 975 |
- status, _, err = sockRequest("POST", "/containers/"+name+"/stop?t=1", nil)
|
|
| 974 |
+ status, _, err = sockRequest("POST", "/containers/"+name+"/stop?t=30", nil)
|
|
| 976 | 975 |
c.Assert(err, checker.IsNil) |
| 977 | 976 |
c.Assert(status, checker.Equals, http.StatusNotModified) |
| 978 | 977 |
} |
| 979 | 978 |
|
| 980 | 979 |
func (s *DockerSuite) TestContainerApiWait(c *check.C) {
|
| 981 |
- testRequires(c, DaemonIsLinux) |
|
| 982 | 980 |
name := "test-api-wait" |
| 983 |
- dockerCmd(c, "run", "--name", name, "busybox", "sleep", "5") |
|
| 981 |
+ dockerCmd(c, "run", "--name", name, "busybox", sleepCmd, "5") |
|
| 984 | 982 |
|
| 985 | 983 |
status, body, err := sockRequest("POST", "/containers/"+name+"/wait", nil)
|
| 986 | 984 |
c.Assert(err, checker.IsNil) |
| 987 | 985 |
c.Assert(status, checker.Equals, http.StatusOK) |
| 988 |
- c.Assert(waitInspect(name, "{{ .State.Running }}", "false", 5*time.Second), checker.IsNil)
|
|
| 986 |
+ c.Assert(waitInspect(name, "{{ .State.Running }}", "false", 60*time.Second), checker.IsNil)
|
|
| 989 | 987 |
|
| 990 | 988 |
var waitres types.ContainerWaitResponse |
| 991 | 989 |
c.Assert(json.Unmarshal(body, &waitres), checker.IsNil) |
| ... | ... |
@@ -993,6 +1021,7 @@ func (s *DockerSuite) TestContainerApiWait(c *check.C) {
|
| 993 | 993 |
} |
| 994 | 994 |
|
| 995 | 995 |
func (s *DockerSuite) TestContainerApiCopy(c *check.C) {
|
| 996 |
+ // TODO Windows to Windows CI. This can be ported. |
|
| 996 | 997 |
testRequires(c, DaemonIsLinux) |
| 997 | 998 |
name := "test-container-api-copy" |
| 998 | 999 |
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt") |
| ... | ... |
@@ -1023,6 +1052,7 @@ func (s *DockerSuite) TestContainerApiCopy(c *check.C) {
|
| 1023 | 1023 |
} |
| 1024 | 1024 |
|
| 1025 | 1025 |
func (s *DockerSuite) TestContainerApiCopyResourcePathEmpty(c *check.C) {
|
| 1026 |
+ // TODO Windows to Windows CI. This can be ported. |
|
| 1026 | 1027 |
testRequires(c, DaemonIsLinux) |
| 1027 | 1028 |
name := "test-container-api-copy-resource-empty" |
| 1028 | 1029 |
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt") |
| ... | ... |
@@ -1038,6 +1068,7 @@ func (s *DockerSuite) TestContainerApiCopyResourcePathEmpty(c *check.C) {
|
| 1038 | 1038 |
} |
| 1039 | 1039 |
|
| 1040 | 1040 |
func (s *DockerSuite) TestContainerApiCopyResourcePathNotFound(c *check.C) {
|
| 1041 |
+ // TODO Windows to Windows CI. This can be ported. |
|
| 1041 | 1042 |
testRequires(c, DaemonIsLinux) |
| 1042 | 1043 |
name := "test-container-api-copy-resource-not-found" |
| 1043 | 1044 |
dockerCmd(c, "run", "--name", name, "busybox") |
| ... | ... |
@@ -1063,8 +1094,7 @@ func (s *DockerSuite) TestContainerApiCopyContainerNotFound(c *check.C) {
|
| 1063 | 1063 |
} |
| 1064 | 1064 |
|
| 1065 | 1065 |
func (s *DockerSuite) TestContainerApiDelete(c *check.C) {
|
| 1066 |
- testRequires(c, DaemonIsLinux) |
|
| 1067 |
- out, _ := dockerCmd(c, "run", "-d", "busybox", "top") |
|
| 1066 |
+ out, _ := dockerCmd(c, "run", "-d", "busybox", sleepCmd, "60") |
|
| 1068 | 1067 |
|
| 1069 | 1068 |
id := strings.TrimSpace(out) |
| 1070 | 1069 |
c.Assert(waitRun(id), checker.IsNil) |
| ... | ... |
@@ -1084,8 +1114,7 @@ func (s *DockerSuite) TestContainerApiDeleteNotExist(c *check.C) {
|
| 1084 | 1084 |
} |
| 1085 | 1085 |
|
| 1086 | 1086 |
func (s *DockerSuite) TestContainerApiDeleteForce(c *check.C) {
|
| 1087 |
- testRequires(c, DaemonIsLinux) |
|
| 1088 |
- out, _ := dockerCmd(c, "run", "-d", "busybox", "top") |
|
| 1087 |
+ out, _ := dockerCmd(c, "run", "-d", "busybox", sleepCmd, "60") |
|
| 1089 | 1088 |
|
| 1090 | 1089 |
id := strings.TrimSpace(out) |
| 1091 | 1090 |
c.Assert(waitRun(id), checker.IsNil) |
| ... | ... |
@@ -1096,6 +1125,7 @@ func (s *DockerSuite) TestContainerApiDeleteForce(c *check.C) {
|
| 1096 | 1096 |
} |
| 1097 | 1097 |
|
| 1098 | 1098 |
func (s *DockerSuite) TestContainerApiDeleteRemoveLinks(c *check.C) {
|
| 1099 |
+ // Windows does not support links |
|
| 1099 | 1100 |
testRequires(c, DaemonIsLinux) |
| 1100 | 1101 |
out, _ := dockerCmd(c, "run", "-d", "--name", "tlink1", "busybox", "top") |
| 1101 | 1102 |
|
| ... | ... |
@@ -1121,8 +1151,7 @@ func (s *DockerSuite) TestContainerApiDeleteRemoveLinks(c *check.C) {
|
| 1121 | 1121 |
} |
| 1122 | 1122 |
|
| 1123 | 1123 |
func (s *DockerSuite) TestContainerApiDeleteConflict(c *check.C) {
|
| 1124 |
- testRequires(c, DaemonIsLinux) |
|
| 1125 |
- out, _ := dockerCmd(c, "run", "-d", "busybox", "top") |
|
| 1124 |
+ out, _ := dockerCmd(c, "run", "-d", "busybox", sleepCmd, "60") |
|
| 1126 | 1125 |
|
| 1127 | 1126 |
id := strings.TrimSpace(out) |
| 1128 | 1127 |
c.Assert(waitRun(id), checker.IsNil) |
| ... | ... |
@@ -1133,15 +1162,19 @@ func (s *DockerSuite) TestContainerApiDeleteConflict(c *check.C) {
|
| 1133 | 1133 |
} |
| 1134 | 1134 |
|
| 1135 | 1135 |
func (s *DockerSuite) TestContainerApiDeleteRemoveVolume(c *check.C) {
|
| 1136 |
- testRequires(c, DaemonIsLinux) |
|
| 1137 | 1136 |
testRequires(c, SameHostDaemon) |
| 1138 | 1137 |
|
| 1139 |
- out, _ := dockerCmd(c, "run", "-d", "-v", "/testvolume", "busybox", "top") |
|
| 1138 |
+ vol := "/testvolume" |
|
| 1139 |
+ if daemonPlatform == "windows" {
|
|
| 1140 |
+ vol = `c:\testvolume` |
|
| 1141 |
+ } |
|
| 1142 |
+ |
|
| 1143 |
+ out, _ := dockerCmd(c, "run", "-d", "-v", vol, "busybox", sleepCmd, "60") |
|
| 1140 | 1144 |
|
| 1141 | 1145 |
id := strings.TrimSpace(out) |
| 1142 | 1146 |
c.Assert(waitRun(id), checker.IsNil) |
| 1143 | 1147 |
|
| 1144 |
- source, err := inspectMountSourceField(id, "/testvolume") |
|
| 1148 |
+ source, err := inspectMountSourceField(id, vol) |
|
| 1145 | 1149 |
_, err = os.Stat(source) |
| 1146 | 1150 |
c.Assert(err, checker.IsNil) |
| 1147 | 1151 |
|
| ... | ... |
@@ -1153,7 +1186,8 @@ func (s *DockerSuite) TestContainerApiDeleteRemoveVolume(c *check.C) {
|
| 1153 | 1153 |
} |
| 1154 | 1154 |
|
| 1155 | 1155 |
// Regression test for https://github.com/docker/docker/issues/6231 |
| 1156 |
-func (s *DockerSuite) TestContainersApiChunkedEncoding(c *check.C) {
|
|
| 1156 |
+func (s *DockerSuite) TestContainerApiChunkedEncoding(c *check.C) {
|
|
| 1157 |
+ // TODO Windows CI: This can be ported |
|
| 1157 | 1158 |
testRequires(c, DaemonIsLinux) |
| 1158 | 1159 |
out, _ := dockerCmd(c, "create", "-v", "/foo", "busybox", "true") |
| 1159 | 1160 |
id := strings.TrimSpace(out) |
| ... | ... |
@@ -1188,9 +1222,8 @@ func (s *DockerSuite) TestContainersApiChunkedEncoding(c *check.C) {
|
| 1188 | 1188 |
c.Assert(binds[0], checker.Equals, expected, check.Commentf("got incorrect bind spec"))
|
| 1189 | 1189 |
} |
| 1190 | 1190 |
|
| 1191 |
-func (s *DockerSuite) TestPostContainerStop(c *check.C) {
|
|
| 1192 |
- testRequires(c, DaemonIsLinux) |
|
| 1193 |
- out, _ := dockerCmd(c, "run", "-d", "busybox", "top") |
|
| 1191 |
+func (s *DockerSuite) TestContainerApiPostContainerStop(c *check.C) {
|
|
| 1192 |
+ out, _ := dockerCmd(c, "run", "-d", "busybox", sleepCmd, "60") |
|
| 1194 | 1193 |
|
| 1195 | 1194 |
containerID := strings.TrimSpace(out) |
| 1196 | 1195 |
c.Assert(waitRun(containerID), checker.IsNil) |
| ... | ... |
@@ -1203,8 +1236,7 @@ func (s *DockerSuite) TestPostContainerStop(c *check.C) {
|
| 1203 | 1203 |
} |
| 1204 | 1204 |
|
| 1205 | 1205 |
// #14170 |
| 1206 |
-func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceEntrypoint(c *check.C) {
|
|
| 1207 |
- testRequires(c, DaemonIsLinux) |
|
| 1206 |
+func (s *DockerSuite) TestPostContainerApiCreateWithStringOrSliceEntrypoint(c *check.C) {
|
|
| 1208 | 1207 |
config := struct {
|
| 1209 | 1208 |
Image string |
| 1210 | 1209 |
Entrypoint string |
| ... | ... |
@@ -1228,7 +1260,6 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceEntrypoint(c *che |
| 1228 | 1228 |
|
| 1229 | 1229 |
// #14170 |
| 1230 | 1230 |
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *check.C) {
|
| 1231 |
- testRequires(c, DaemonIsLinux) |
|
| 1232 | 1231 |
config := struct {
|
| 1233 | 1232 |
Image string |
| 1234 | 1233 |
Entrypoint string |
| ... | ... |
@@ -1251,6 +1282,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *check.C) {
|
| 1251 | 1251 |
|
| 1252 | 1252 |
// regression #14318 |
| 1253 | 1253 |
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *check.C) {
|
| 1254 |
+ // Windows doesn't support CapAdd/CapDrop |
|
| 1254 | 1255 |
testRequires(c, DaemonIsLinux) |
| 1255 | 1256 |
config := struct {
|
| 1256 | 1257 |
Image string |
| ... | ... |
@@ -1273,9 +1305,11 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *che |
| 1273 | 1273 |
|
| 1274 | 1274 |
// #14640 |
| 1275 | 1275 |
func (s *DockerSuite) TestPostContainersStartWithoutLinksInHostConfig(c *check.C) {
|
| 1276 |
+ // TODO Windows: Windows doesn't support supplying a hostconfig on start. |
|
| 1277 |
+ // An alternate test could be written to validate the negative testing aspect of this |
|
| 1276 | 1278 |
testRequires(c, DaemonIsLinux) |
| 1277 | 1279 |
name := "test-host-config-links" |
| 1278 |
- dockerCmd(c, "create", "--name", name, "busybox", "top") |
|
| 1280 |
+ dockerCmd(c, "create", "--name", name, "busybox", sleepCmd, "60") |
|
| 1279 | 1281 |
|
| 1280 | 1282 |
hc, err := inspectFieldJSON(name, "HostConfig") |
| 1281 | 1283 |
c.Assert(err, checker.IsNil) |
| ... | ... |
@@ -1289,6 +1323,8 @@ func (s *DockerSuite) TestPostContainersStartWithoutLinksInHostConfig(c *check.C |
| 1289 | 1289 |
|
| 1290 | 1290 |
// #14640 |
| 1291 | 1291 |
func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfig(c *check.C) {
|
| 1292 |
+ // TODO Windows: Windows doesn't support supplying a hostconfig on start. |
|
| 1293 |
+ // An alternate test could be written to validate the negative testing aspect of this |
|
| 1292 | 1294 |
testRequires(c, DaemonIsLinux) |
| 1293 | 1295 |
name := "test-host-config-links" |
| 1294 | 1296 |
dockerCmd(c, "run", "--name", "foo", "-d", "busybox", "top") |
| ... | ... |
@@ -1306,6 +1342,7 @@ func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfig(c *check.C) {
|
| 1306 | 1306 |
|
| 1307 | 1307 |
// #14640 |
| 1308 | 1308 |
func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfigIdLinked(c *check.C) {
|
| 1309 |
+ // Windows does not support links |
|
| 1309 | 1310 |
testRequires(c, DaemonIsLinux) |
| 1310 | 1311 |
name := "test-host-config-links" |
| 1311 | 1312 |
out, _ := dockerCmd(c, "run", "--name", "link0", "-d", "busybox", "top") |
| ... | ... |
@@ -1323,8 +1360,7 @@ func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfigIdLinked(c *ch |
| 1323 | 1323 |
} |
| 1324 | 1324 |
|
| 1325 | 1325 |
// #14915 |
| 1326 |
-func (s *DockerSuite) TestContainersApiCreateNoHostConfig118(c *check.C) {
|
|
| 1327 |
- testRequires(c, DaemonIsLinux) |
|
| 1326 |
+func (s *DockerSuite) TestContainerApiCreateNoHostConfig118(c *check.C) {
|
|
| 1328 | 1327 |
config := struct {
|
| 1329 | 1328 |
Image string |
| 1330 | 1329 |
}{"busybox"}
|
| ... | ... |
@@ -1337,6 +1373,7 @@ func (s *DockerSuite) TestContainersApiCreateNoHostConfig118(c *check.C) {
|
| 1337 | 1337 |
// extract an archive to a symlink in a writable volume which points to a |
| 1338 | 1338 |
// directory outside of the volume. |
| 1339 | 1339 |
func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(c *check.C) {
|
| 1340 |
+ // Windows does not support read-only rootfs |
|
| 1340 | 1341 |
// Requires local volume mount bind. |
| 1341 | 1342 |
// --read-only + userns has remount issues |
| 1342 | 1343 |
testRequires(c, SameHostDaemon, NotUserNamespace, DaemonIsLinux) |
| ... | ... |
@@ -1367,9 +1404,7 @@ func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs( |
| 1367 | 1367 |
} |
| 1368 | 1368 |
} |
| 1369 | 1369 |
|
| 1370 |
-func (s *DockerSuite) TestContainersApiGetContainersJSONEmpty(c *check.C) {
|
|
| 1371 |
- testRequires(c, DaemonIsLinux) |
|
| 1372 |
- |
|
| 1370 |
+func (s *DockerSuite) TestContainerApiGetContainersJSONEmpty(c *check.C) {
|
|
| 1373 | 1371 |
status, body, err := sockRequest("GET", "/containers/json?all=1", nil)
|
| 1374 | 1372 |
c.Assert(err, checker.IsNil) |
| 1375 | 1373 |
c.Assert(status, checker.Equals, http.StatusOK) |
| ... | ... |
@@ -1377,6 +1412,7 @@ func (s *DockerSuite) TestContainersApiGetContainersJSONEmpty(c *check.C) {
|
| 1377 | 1377 |
} |
| 1378 | 1378 |
|
| 1379 | 1379 |
func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C) {
|
| 1380 |
+ // Not supported on Windows |
|
| 1380 | 1381 |
testRequires(c, DaemonIsLinux) |
| 1381 | 1382 |
|
| 1382 | 1383 |
c1 := struct {
|
| ... | ... |
@@ -1403,6 +1439,7 @@ func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C) |
| 1403 | 1403 |
} |
| 1404 | 1404 |
|
| 1405 | 1405 |
func (s *DockerSuite) TestStartWithNilDNS(c *check.C) {
|
| 1406 |
+ // TODO Windows: Add once DNS is supported |
|
| 1406 | 1407 |
testRequires(c, DaemonIsLinux) |
| 1407 | 1408 |
out, _ := dockerCmd(c, "create", "busybox") |
| 1408 | 1409 |
containerID := strings.TrimSpace(out) |
| ... | ... |
@@ -1420,6 +1457,7 @@ func (s *DockerSuite) TestStartWithNilDNS(c *check.C) {
|
| 1420 | 1420 |
} |
| 1421 | 1421 |
|
| 1422 | 1422 |
func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) {
|
| 1423 |
+ // ShmSize is not supported on Windows |
|
| 1423 | 1424 |
testRequires(c, DaemonIsLinux) |
| 1424 | 1425 |
config := map[string]interface{}{
|
| 1425 | 1426 |
"Image": "busybox", |
| ... | ... |
@@ -1433,6 +1471,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) {
|
| 1433 | 1433 |
} |
| 1434 | 1434 |
|
| 1435 | 1435 |
func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check.C) {
|
| 1436 |
+ // ShmSize is not supported on Windows |
|
| 1436 | 1437 |
testRequires(c, DaemonIsLinux) |
| 1437 | 1438 |
var defaultSHMSize int64 = 67108864 |
| 1438 | 1439 |
config := map[string]interface{}{
|
| ... | ... |
@@ -1464,6 +1503,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check. |
| 1464 | 1464 |
} |
| 1465 | 1465 |
|
| 1466 | 1466 |
func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) {
|
| 1467 |
+ // ShmSize is not supported on Windows |
|
| 1467 | 1468 |
testRequires(c, DaemonIsLinux) |
| 1468 | 1469 |
config := map[string]interface{}{
|
| 1469 | 1470 |
"Image": "busybox", |
| ... | ... |
@@ -1495,6 +1535,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) {
|
| 1495 | 1495 |
} |
| 1496 | 1496 |
|
| 1497 | 1497 |
func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) {
|
| 1498 |
+ // ShmSize is not supported on Windows |
|
| 1498 | 1499 |
testRequires(c, DaemonIsLinux) |
| 1499 | 1500 |
config := map[string]interface{}{
|
| 1500 | 1501 |
"Image": "busybox", |
| ... | ... |
@@ -1526,6 +1567,7 @@ func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) {
|
| 1526 | 1526 |
} |
| 1527 | 1527 |
|
| 1528 | 1528 |
func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(c *check.C) {
|
| 1529 |
+ // Swappiness is not supported on Windows |
|
| 1529 | 1530 |
testRequires(c, DaemonIsLinux) |
| 1530 | 1531 |
config := map[string]interface{}{
|
| 1531 | 1532 |
"Image": "busybox", |
| ... | ... |
@@ -1550,6 +1592,7 @@ func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted( |
| 1550 | 1550 |
|
| 1551 | 1551 |
// check validation is done daemon side and not only in cli |
| 1552 | 1552 |
func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *check.C) {
|
| 1553 |
+ // OomScoreAdj is not supported on Windows |
|
| 1553 | 1554 |
testRequires(c, DaemonIsLinux) |
| 1554 | 1555 |
|
| 1555 | 1556 |
config := struct {
|