1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

integration-cli: split DockerSuite into subsequent build suites

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2022-06-16 23:32:10 +02:00
parent 7ed823ead9
commit 0e6a1b9596
67 changed files with 1844 additions and 1147 deletions

View File

@ -36,7 +36,7 @@ import (
"gotest.tools/v3/poll"
)
func (s *DockerSuite) TestContainerAPIGetAll(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIGetAll(c *testing.T) {
startCount := getContainerCount(c)
name := "getall"
dockerCmd(c, "run", "--name", name, "busybox", "true")
@ -56,7 +56,7 @@ func (s *DockerSuite) TestContainerAPIGetAll(c *testing.T) {
}
// regression test for empty json field being omitted #13691
func (s *DockerSuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) {
startCount := getContainerCount(c)
dockerCmd(c, "run", "busybox", "true")
@ -96,7 +96,7 @@ func (s *DockerSuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) {
}
}
func (s *DockerSuite) TestContainerAPIGetExport(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIGetExport(c *testing.T) {
// Not supported on Windows as Windows does not support docker export
testRequires(c, DaemonIsLinux)
name := "exportcontainer"
@ -123,7 +123,7 @@ func (s *DockerSuite) TestContainerAPIGetExport(c *testing.T) {
assert.Assert(c, found, "The created test file has not been found in the exported image")
}
func (s *DockerSuite) TestContainerAPIGetChanges(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIGetChanges(c *testing.T) {
// Not supported on Windows as Windows does not support docker diff (/containers/name/changes)
testRequires(c, DaemonIsLinux)
name := "changescontainer"
@ -146,7 +146,7 @@ func (s *DockerSuite) TestContainerAPIGetChanges(c *testing.T) {
assert.Assert(c, success, "/etc/passwd has been removed but is not present in the diff")
}
func (s *DockerSuite) TestGetContainerStats(c *testing.T) {
func (s *DockerAPISuite) TestGetContainerStats(c *testing.T) {
var (
name = "statscontainer"
)
@ -186,7 +186,7 @@ func (s *DockerSuite) TestGetContainerStats(c *testing.T) {
}
}
func (s *DockerSuite) TestGetContainerStatsRmRunning(c *testing.T) {
func (s *DockerAPISuite) TestGetContainerStatsRmRunning(c *testing.T) {
out := runSleepingContainer(c)
id := strings.TrimSpace(out)
@ -253,7 +253,7 @@ func (c *ChannelBuffer) ReadTimeout(p []byte, n time.Duration) (int, error) {
// regression test for gh13421
// 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 *testing.T) {
func (s *DockerAPISuite) TestGetContainerStatsStream(c *testing.T) {
name := "statscontainer"
runSleepingContainer(c, "--name", name)
@ -294,7 +294,7 @@ func (s *DockerSuite) TestGetContainerStatsStream(c *testing.T) {
}
}
func (s *DockerSuite) TestGetContainerStatsNoStream(c *testing.T) {
func (s *DockerAPISuite) TestGetContainerStatsNoStream(c *testing.T) {
name := "statscontainer"
runSleepingContainer(c, "--name", name)
@ -334,7 +334,7 @@ func (s *DockerSuite) TestGetContainerStatsNoStream(c *testing.T) {
}
}
func (s *DockerSuite) TestGetStoppedContainerStats(c *testing.T) {
func (s *DockerAPISuite) TestGetStoppedContainerStats(c *testing.T) {
name := "statscontainer"
dockerCmd(c, "create", "--name", name, "busybox", "ps")
@ -361,7 +361,7 @@ func (s *DockerSuite) TestGetStoppedContainerStats(c *testing.T) {
}
}
func (s *DockerSuite) TestContainerAPIPause(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIPause(c *testing.T) {
// Problematic on Windows as Windows does not support pause
testRequires(c, DaemonIsLinux)
@ -392,7 +392,7 @@ func (s *DockerSuite) TestContainerAPIPause(c *testing.T) {
assert.Equal(c, len(pausedContainers), 0, "There should be no paused container.")
}
func (s *DockerSuite) TestContainerAPITop(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPITop(c *testing.T) {
testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "top && true")
id := strings.TrimSpace(out)
@ -415,7 +415,7 @@ func (s *DockerSuite) TestContainerAPITop(c *testing.T) {
assert.Equal(c, top.Processes[1][10], "top")
}
func (s *DockerSuite) TestContainerAPITopWindows(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPITopWindows(c *testing.T) {
testRequires(c, DaemonIsWindows)
out := runSleepingContainer(c, "-d")
id := strings.TrimSpace(out)
@ -446,7 +446,7 @@ func (s *DockerSuite) TestContainerAPITopWindows(c *testing.T) {
assert.Assert(c, foundProcess, "expected to find %s: %v", expectedProcess, top.Processes)
}
func (s *DockerSuite) TestContainerAPICommit(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICommit(c *testing.T) {
cName := "testapicommit"
dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
@ -468,7 +468,7 @@ func (s *DockerSuite) TestContainerAPICommit(c *testing.T) {
dockerCmd(c, "run", img.ID, "ls", "/test")
}
func (s *DockerSuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
cName := "testapicommitwithconfig"
dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
@ -500,7 +500,7 @@ func (s *DockerSuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
dockerCmd(c, "run", img.ID, "ls", "/test")
}
func (s *DockerSuite) TestContainerAPIBadPort(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIBadPort(c *testing.T) {
// TODO Windows to Windows CI - Port this test
testRequires(c, DaemonIsLinux)
@ -527,7 +527,7 @@ func (s *DockerSuite) TestContainerAPIBadPort(c *testing.T) {
assert.ErrorContains(c, err, `invalid port specification: "aa80"`)
}
func (s *DockerSuite) TestContainerAPICreate(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICreate(c *testing.T) {
config := container.Config{
Image: "busybox",
Cmd: []string{"/bin/sh", "-c", "touch /test && ls /test"},
@ -544,7 +544,7 @@ func (s *DockerSuite) TestContainerAPICreate(c *testing.T) {
assert.Equal(c, strings.TrimSpace(out), "/test")
}
func (s *DockerSuite) TestContainerAPICreateEmptyConfig(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICreateEmptyConfig(c *testing.T) {
cli, err := client.NewClientWithOpts(client.FromEnv)
assert.NilError(c, err)
@ -556,7 +556,7 @@ func (s *DockerSuite) TestContainerAPICreateEmptyConfig(c *testing.T) {
assert.ErrorContains(c, err, expected)
}
func (s *DockerSuite) TestContainerAPICreateMultipleNetworksConfig(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICreateMultipleNetworksConfig(c *testing.T) {
// Container creation must fail if client specified configurations for more than one network
config := container.Config{
Image: "busybox",
@ -583,13 +583,13 @@ func (s *DockerSuite) TestContainerAPICreateMultipleNetworksConfig(c *testing.T)
assert.Assert(c, strings.Contains(msg, "net3"))
}
func (s *DockerSuite) TestContainerAPICreateBridgeNetworkMode(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICreateBridgeNetworkMode(c *testing.T) {
// Windows does not support bridge
testRequires(c, DaemonIsLinux)
UtilCreateNetworkMode(c, "bridge")
}
func (s *DockerSuite) TestContainerAPICreateOtherNetworkModes(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICreateOtherNetworkModes(c *testing.T) {
// Windows does not support these network modes
testRequires(c, DaemonIsLinux, NotUserNamespace)
UtilCreateNetworkMode(c, "host")
@ -618,7 +618,7 @@ func UtilCreateNetworkMode(c *testing.T, networkMode container.NetworkMode) {
assert.Equal(c, containerJSON.HostConfig.NetworkMode, networkMode, "Mismatched NetworkMode")
}
func (s *DockerSuite) TestContainerAPICreateWithCpuSharesCpuset(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICreateWithCpuSharesCpuset(c *testing.T) {
// TODO Windows to Windows CI. The CpuShares part could be ported.
testRequires(c, DaemonIsLinux)
config := container.Config{
@ -649,7 +649,7 @@ func (s *DockerSuite) TestContainerAPICreateWithCpuSharesCpuset(c *testing.T) {
assert.Equal(c, outCpuset, "0")
}
func (s *DockerSuite) TestContainerAPIVerifyHeader(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIVerifyHeader(c *testing.T) {
config := map[string]interface{}{
"Image": "busybox",
}
@ -690,7 +690,7 @@ func (s *DockerSuite) TestContainerAPIVerifyHeader(c *testing.T) {
}
// Issue 14230. daemon should return 500 for invalid port syntax
func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIInvalidPortSyntax(c *testing.T) {
config := `{
"Image": "busybox",
"HostConfig": {
@ -716,7 +716,7 @@ func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *testing.T) {
assert.Assert(c, strings.Contains(string(b[:]), "invalid port"))
}
func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *testing.T) {
config := `{
"Image": "busybox",
"HostConfig": {
@ -740,7 +740,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *testing.
assert.Assert(c, strings.Contains(string(b[:]), "invalid restart policy"))
}
func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIRestartPolicyRetryMismatch(c *testing.T) {
config := `{
"Image": "busybox",
"HostConfig": {
@ -764,7 +764,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *testing.T) {
assert.Assert(c, strings.Contains(string(b[:]), "maximum retry count cannot be used with restart policy"))
}
func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *testing.T) {
config := `{
"Image": "busybox",
"HostConfig": {
@ -788,7 +788,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *testing
assert.Assert(c, strings.Contains(string(b[:]), "maximum retry count cannot be negative"))
}
func (s *DockerSuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *testing.T) {
config := `{
"Image": "busybox",
"HostConfig": {
@ -806,7 +806,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *testing.
// 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 *testing.T) {
func (s *DockerAPISuite) TestContainerAPIPostCreateNull(c *testing.T) {
config := `{
"Hostname":"",
"Domainname":"",
@ -850,7 +850,7 @@ func (s *DockerSuite) TestContainerAPIPostCreateNull(c *testing.T) {
assert.Equal(c, outMemorySwap, "0")
}
func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
func (s *DockerAPISuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
// TODO Windows: Port once memory is supported
testRequires(c, DaemonIsLinux)
config := `{
@ -874,7 +874,7 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
assert.Assert(c, strings.Contains(string(b), "Minimum memory limit allowed is 6MB"))
}
func (s *DockerSuite) TestContainerAPIRename(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIRename(c *testing.T) {
out, _ := dockerCmd(c, "run", "--name", "TestContainerAPIRename", "-d", "busybox", "sh")
containerID := strings.TrimSpace(out)
@ -891,7 +891,7 @@ func (s *DockerSuite) TestContainerAPIRename(c *testing.T) {
assert.Equal(c, name, "/"+newName, "Failed to rename container")
}
func (s *DockerSuite) TestContainerAPIKill(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIKill(c *testing.T) {
name := "test-api-kill"
runSleepingContainer(c, "-i", "--name", name)
@ -906,7 +906,7 @@ func (s *DockerSuite) TestContainerAPIKill(c *testing.T) {
assert.Equal(c, state, "false", fmt.Sprintf("got wrong State from container %s: %q", name, state))
}
func (s *DockerSuite) TestContainerAPIRestart(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIRestart(c *testing.T) {
name := "test-api-restart"
runSleepingContainer(c, "-di", "--name", name)
cli, err := client.NewClientWithOpts(client.FromEnv)
@ -920,7 +920,7 @@ func (s *DockerSuite) TestContainerAPIRestart(c *testing.T) {
assert.Assert(c, waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second) == nil)
}
func (s *DockerSuite) TestContainerAPIRestartNotimeoutParam(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIRestartNotimeoutParam(c *testing.T) {
name := "test-api-restart-no-timeout-param"
out := runSleepingContainer(c, "-di", "--name", name)
id := strings.TrimSpace(out)
@ -936,7 +936,7 @@ func (s *DockerSuite) TestContainerAPIRestartNotimeoutParam(c *testing.T) {
assert.Assert(c, waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second) == nil)
}
func (s *DockerSuite) TestContainerAPIStart(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIStart(c *testing.T) {
name := "testing-start"
config := container.Config{
Image: "busybox",
@ -962,7 +962,7 @@ func (s *DockerSuite) TestContainerAPIStart(c *testing.T) {
// TODO(tibor): figure out why this doesn't work on windows
}
func (s *DockerSuite) TestContainerAPIStop(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIStop(c *testing.T) {
name := "test-api-stop"
runSleepingContainer(c, "-i", "--name", name)
timeout := 30
@ -985,7 +985,7 @@ func (s *DockerSuite) TestContainerAPIStop(c *testing.T) {
assert.NilError(c, err)
}
func (s *DockerSuite) TestContainerAPIWait(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIWait(c *testing.T) {
name := "test-api-wait"
sleepCmd := "/bin/sleep"
@ -1008,7 +1008,7 @@ func (s *DockerSuite) TestContainerAPIWait(c *testing.T) {
}
}
func (s *DockerSuite) TestContainerAPICopyNotExistsAnyMore(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICopyNotExistsAnyMore(c *testing.T) {
name := "test-container-api-copy"
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
@ -1021,7 +1021,7 @@ func (s *DockerSuite) TestContainerAPICopyNotExistsAnyMore(c *testing.T) {
assert.Equal(c, res.StatusCode, http.StatusNotFound)
}
func (s *DockerSuite) TestContainerAPICopyPre124(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICopyPre124(c *testing.T) {
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
name := "test-container-api-copy"
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
@ -1051,7 +1051,7 @@ func (s *DockerSuite) TestContainerAPICopyPre124(c *testing.T) {
assert.Assert(c, found)
}
func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T) {
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
name := "test-container-api-copy-resource-empty"
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
@ -1073,7 +1073,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T)
}
func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing.T) {
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
name := "test-container-api-copy-resource-not-found"
dockerCmd(c, "run", "--name", name, "busybox")
@ -1095,7 +1095,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing.
}
func (s *DockerSuite) TestContainerAPICopyContainerNotFoundPr124(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICopyContainerNotFoundPr124(c *testing.T) {
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
postData := types.CopyConfig{
Resource: "/something",
@ -1106,7 +1106,7 @@ func (s *DockerSuite) TestContainerAPICopyContainerNotFoundPr124(c *testing.T) {
assert.Equal(c, res.StatusCode, http.StatusNotFound)
}
func (s *DockerSuite) TestContainerAPIDelete(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIDelete(c *testing.T) {
out := runSleepingContainer(c)
id := strings.TrimSpace(out)
@ -1122,7 +1122,7 @@ func (s *DockerSuite) TestContainerAPIDelete(c *testing.T) {
assert.NilError(c, err)
}
func (s *DockerSuite) TestContainerAPIDeleteNotExist(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIDeleteNotExist(c *testing.T) {
cli, err := client.NewClientWithOpts(client.FromEnv)
assert.NilError(c, err)
defer cli.Close()
@ -1131,7 +1131,7 @@ func (s *DockerSuite) TestContainerAPIDeleteNotExist(c *testing.T) {
assert.ErrorContains(c, err, "No such container: doesnotexist")
}
func (s *DockerSuite) TestContainerAPIDeleteForce(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIDeleteForce(c *testing.T) {
out := runSleepingContainer(c)
id := strings.TrimSpace(out)
assert.NilError(c, waitRun(id))
@ -1148,7 +1148,7 @@ func (s *DockerSuite) TestContainerAPIDeleteForce(c *testing.T) {
assert.NilError(c, err)
}
func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
// Windows does not support links
testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "--name", "tlink1", "busybox", "top")
@ -1179,7 +1179,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
assert.Equal(c, linksPostRm, "null", "call to api deleteContainer links should have removed the specified links")
}
func (s *DockerSuite) TestContainerAPIDeleteConflict(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIDeleteConflict(c *testing.T) {
out := runSleepingContainer(c)
id := strings.TrimSpace(out)
@ -1194,7 +1194,7 @@ func (s *DockerSuite) TestContainerAPIDeleteConflict(c *testing.T) {
assert.ErrorContains(c, err, expected)
}
func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
testRequires(c, testEnv.IsLocalDaemon)
vol := "/testvolume"
@ -1229,7 +1229,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
}
// Regression test for https://github.com/docker/docker/issues/6231
func (s *DockerSuite) TestContainerAPIChunkedEncoding(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIChunkedEncoding(c *testing.T) {
config := map[string]interface{}{
"Image": "busybox",
@ -1249,7 +1249,7 @@ func (s *DockerSuite) TestContainerAPIChunkedEncoding(c *testing.T) {
assert.Equal(c, resp.StatusCode, http.StatusCreated)
}
func (s *DockerSuite) TestContainerAPIPostContainerStop(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIPostContainerStop(c *testing.T) {
out := runSleepingContainer(c)
containerID := strings.TrimSpace(out)
@ -1265,7 +1265,7 @@ func (s *DockerSuite) TestContainerAPIPostContainerStop(c *testing.T) {
}
// #14170
func (s *DockerSuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c *testing.T) {
func (s *DockerAPISuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c *testing.T) {
config := container.Config{
Image: "busybox",
Entrypoint: []string{"echo"},
@ -1293,7 +1293,7 @@ func (s *DockerSuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c *t
}
// #14170
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *testing.T) {
func (s *DockerAPISuite) TestPostContainersCreateWithStringOrSliceCmd(c *testing.T) {
config := container.Config{
Image: "busybox",
Cmd: []string{"echo", "hello", "world"},
@ -1322,7 +1322,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *testing.T)
// regression #14318
// for backward compatibility testing with and without CAP_ prefix
// and with upper and lowercase
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *testing.T) {
func (s *DockerAPISuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *testing.T) {
// Windows doesn't support CapAdd/CapDrop
testRequires(c, DaemonIsLinux)
config := struct {
@ -1351,7 +1351,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *tes
}
// #14915
func (s *DockerSuite) TestContainerAPICreateNoHostConfig118(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICreateNoHostConfig118(c *testing.T) {
testRequires(c, DaemonIsLinux) // Windows only support 1.25 or later
config := container.Config{
Image: "busybox",
@ -1367,7 +1367,7 @@ func (s *DockerSuite) TestContainerAPICreateNoHostConfig118(c *testing.T) {
// Ensure an error occurs when you have a container read-only rootfs but you
// extract an archive to a symlink in a writable volume which points to a
// directory outside of the volume.
func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(c *testing.T) {
func (s *DockerAPISuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(c *testing.T) {
// Windows does not support read-only rootfs
// Requires local volume mount bind.
// --read-only + userns has remount issues
@ -1393,7 +1393,7 @@ func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(
assert.ErrorContains(c, err, "container rootfs is marked read-only")
}
func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *testing.T) {
func (s *DockerAPISuite) TestPostContainersCreateWithWrongCpusetValues(c *testing.T) {
// Not supported on Windows
testRequires(c, DaemonIsLinux)
@ -1426,7 +1426,7 @@ func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *testing.T
assert.ErrorContains(c, err, expected)
}
func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *testing.T) {
func (s *DockerAPISuite) TestPostContainersCreateShmSizeNegative(c *testing.T) {
// ShmSize is not supported on Windows
testRequires(c, DaemonIsLinux)
config := container.Config{
@ -1444,7 +1444,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *testing.T) {
assert.ErrorContains(c, err, "SHM size can not be less than 0")
}
func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *testing.T) {
func (s *DockerAPISuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *testing.T) {
// ShmSize is not supported on Windows
testRequires(c, DaemonIsLinux)
@ -1472,7 +1472,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *testin
}
}
func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *testing.T) {
func (s *DockerAPISuite) TestPostContainersCreateShmSizeOmitted(c *testing.T) {
// ShmSize is not supported on Windows
testRequires(c, DaemonIsLinux)
config := container.Config{
@ -1499,7 +1499,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *testing.T) {
}
}
func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *testing.T) {
func (s *DockerAPISuite) TestPostContainersCreateWithShmSize(c *testing.T) {
// ShmSize is not supported on Windows
testRequires(c, DaemonIsLinux)
config := container.Config{
@ -1530,7 +1530,7 @@ func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *testing.T) {
}
}
func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(c *testing.T) {
func (s *DockerAPISuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(c *testing.T) {
// Swappiness is not supported on Windows
testRequires(c, DaemonIsLinux)
config := container.Config{
@ -1555,7 +1555,7 @@ func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(
}
// check validation is done daemon side and not only in cli
func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *testing.T) {
func (s *DockerAPISuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *testing.T) {
// OomScoreAdj is not supported on Windows
testRequires(c, DaemonIsLinux)
@ -1589,7 +1589,7 @@ func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *tes
}
// test case for #22210 where an empty container name caused panic.
func (s *DockerSuite) TestContainerAPIDeleteWithEmptyName(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIDeleteWithEmptyName(c *testing.T) {
cli, err := client.NewClientWithOpts(client.FromEnv)
assert.NilError(c, err)
defer cli.Close()
@ -1598,7 +1598,7 @@ func (s *DockerSuite) TestContainerAPIDeleteWithEmptyName(c *testing.T) {
assert.Check(c, errdefs.IsNotFound(err))
}
func (s *DockerSuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T) {
// Problematic on Windows as Windows does not support stats
testRequires(c, DaemonIsLinux)
@ -1647,7 +1647,7 @@ func (s *DockerSuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T) {
}
}
func (s *DockerSuite) TestContainersAPICreateMountsValidation(c *testing.T) {
func (s *DockerAPISuite) TestContainersAPICreateMountsValidation(c *testing.T) {
type testCase struct {
config container.Config
hostConfig container.HostConfig
@ -1940,7 +1940,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsValidation(c *testing.T) {
}
}
func (s *DockerSuite) TestContainerAPICreateMountsBindRead(c *testing.T) {
func (s *DockerAPISuite) TestContainerAPICreateMountsBindRead(c *testing.T) {
testRequires(c, NotUserNamespace, testEnv.IsLocalDaemon)
// also with data in the host side
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
@ -1971,7 +1971,7 @@ func (s *DockerSuite) TestContainerAPICreateMountsBindRead(c *testing.T) {
}
// Test Mounts comes out as expected for the MountPoint
func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *testing.T) {
func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
destPath := prefix + slash + "foo"
@ -2180,7 +2180,7 @@ func containerExit(apiclient client.APIClient, name string) func(poll.LogT) poll
}
}
func (s *DockerSuite) TestContainersAPICreateMountsTmpfs(c *testing.T) {
func (s *DockerAPISuite) TestContainersAPICreateMountsTmpfs(c *testing.T) {
testRequires(c, DaemonIsLinux)
type testCase struct {
cfg mount.Mount
@ -2230,7 +2230,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsTmpfs(c *testing.T) {
// Regression test for #33334
// Makes sure that when a container which has a custom stop signal + restart=always
// gets killed (with SIGKILL) by the kill API, that the restart policy is cancelled.
func (s *DockerSuite) TestContainerKillCustomStopSignal(c *testing.T) {
func (s *DockerAPISuite) TestContainerKillCustomStopSignal(c *testing.T) {
id := strings.TrimSpace(runSleepingContainer(c, "--stop-signal=SIGTERM", "--restart=always"))
res, _, err := request.Post("/containers/" + id + "/kill")
assert.NilError(c, err)