[19.03 backport] Integration: change signatures to fix golint warnings
| ... | ... |
@@ -79,7 +79,7 @@ func TestBuildSquashParent(t *testing.T) {
|
| 79 | 79 |
resp.Body.Close() |
| 80 | 80 |
assert.NilError(t, err) |
| 81 | 81 |
|
| 82 |
- cid := container.Run(t, ctx, client, |
|
| 82 |
+ cid := container.Run(ctx, t, client, |
|
| 83 | 83 |
container.WithImage(name), |
| 84 | 84 |
container.WithCmd("/bin/sh", "-c", "cat /hello"),
|
| 85 | 85 |
) |
| ... | ... |
@@ -94,11 +94,11 @@ func TestBuildSquashParent(t *testing.T) {
|
| 94 | 94 |
assert.NilError(t, err) |
| 95 | 95 |
assert.Check(t, is.Equal(strings.TrimSpace(actualStdout.String()), "hello\nworld")) |
| 96 | 96 |
|
| 97 |
- container.Run(t, ctx, client, |
|
| 97 |
+ container.Run(ctx, t, client, |
|
| 98 | 98 |
container.WithImage(name), |
| 99 | 99 |
container.WithCmd("/bin/sh", "-c", "[ ! -f /remove_me ]"),
|
| 100 | 100 |
) |
| 101 |
- container.Run(t, ctx, client, |
|
| 101 |
+ container.Run(ctx, t, client, |
|
| 102 | 102 |
container.WithImage(name), |
| 103 | 103 |
container.WithCmd("/bin/sh", "-c", `[ "$(echo $HELLO)" == "world" ]`),
|
| 104 | 104 |
) |
| ... | ... |
@@ -50,7 +50,7 @@ func TestCheckpoint(t *testing.T) {
|
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
t.Log("Start a container")
|
| 53 |
- cID := container.Run(t, ctx, client, container.WithMount(mnt)) |
|
| 53 |
+ cID := container.Run(ctx, t, client, container.WithMount(mnt)) |
|
| 54 | 54 |
poll.WaitOn(t, |
| 55 | 55 |
container.IsInState(ctx, client, cID, "running"), |
| 56 | 56 |
poll.WithDelay(100*time.Millisecond), |
| ... | ... |
@@ -26,7 +26,7 @@ func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
|
| 26 | 26 |
|
| 27 | 27 |
ctx := context.Background() |
| 28 | 28 |
apiclient := testEnv.APIClient() |
| 29 |
- cid := container.Create(t, ctx, apiclient) |
|
| 29 |
+ cid := container.Create(ctx, t, apiclient) |
|
| 30 | 30 |
|
| 31 | 31 |
_, _, err := apiclient.CopyFromContainer(ctx, cid, "/dne") |
| 32 | 32 |
assert.Check(t, client.IsErrNotFound(err)) |
| ... | ... |
@@ -40,7 +40,7 @@ func TestCopyFromContainerPathIsNotDir(t *testing.T) {
|
| 40 | 40 |
|
| 41 | 41 |
ctx := context.Background() |
| 42 | 42 |
apiclient := testEnv.APIClient() |
| 43 |
- cid := container.Create(t, ctx, apiclient) |
|
| 43 |
+ cid := container.Create(ctx, t, apiclient) |
|
| 44 | 44 |
|
| 45 | 45 |
_, _, err := apiclient.CopyFromContainer(ctx, cid, "/etc/passwd/") |
| 46 | 46 |
assert.Assert(t, is.ErrorContains(err, "not a directory")) |
| ... | ... |
@@ -52,7 +52,7 @@ func TestCopyToContainerPathDoesNotExist(t *testing.T) {
|
| 52 | 52 |
|
| 53 | 53 |
ctx := context.Background() |
| 54 | 54 |
apiclient := testEnv.APIClient() |
| 55 |
- cid := container.Create(t, ctx, apiclient) |
|
| 55 |
+ cid := container.Create(ctx, t, apiclient) |
|
| 56 | 56 |
|
| 57 | 57 |
err := apiclient.CopyToContainer(ctx, cid, "/dne", nil, types.CopyToContainerOptions{})
|
| 58 | 58 |
assert.Check(t, client.IsErrNotFound(err)) |
| ... | ... |
@@ -66,7 +66,7 @@ func TestCopyToContainerPathIsNotDir(t *testing.T) {
|
| 66 | 66 |
|
| 67 | 67 |
ctx := context.Background() |
| 68 | 68 |
apiclient := testEnv.APIClient() |
| 69 |
- cid := container.Create(t, ctx, apiclient) |
|
| 69 |
+ cid := container.Create(ctx, t, apiclient) |
|
| 70 | 70 |
|
| 71 | 71 |
err := apiclient.CopyToContainer(ctx, cid, "/etc/passwd/", nil, types.CopyToContainerOptions{})
|
| 72 | 72 |
assert.Assert(t, is.ErrorContains(err, "not a directory")) |
| ... | ... |
@@ -105,7 +105,7 @@ func TestCopyFromContainer(t *testing.T) {
|
| 105 | 105 |
assert.NilError(t, err) |
| 106 | 106 |
assert.Assert(t, imageID != "") |
| 107 | 107 |
|
| 108 |
- cid := container.Create(t, ctx, apiClient, container.WithImage(imageID)) |
|
| 108 |
+ cid := container.Create(ctx, t, apiClient, container.WithImage(imageID)) |
|
| 109 | 109 |
|
| 110 | 110 |
for _, x := range []struct {
|
| 111 | 111 |
src string |
| ... | ... |
@@ -40,7 +40,7 @@ func TestContainerStartOnDaemonRestart(t *testing.T) {
|
| 40 | 40 |
|
| 41 | 41 |
ctx := context.Background() |
| 42 | 42 |
|
| 43 |
- cID := container.Create(t, ctx, c) |
|
| 43 |
+ cID := container.Create(ctx, t, c) |
|
| 44 | 44 |
defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
|
| 45 | 45 |
|
| 46 | 46 |
err := c.ContainerStart(ctx, cID, types.ContainerStartOptions{})
|
| ... | ... |
@@ -94,7 +94,7 @@ func TestDaemonRestartIpcMode(t *testing.T) {
|
| 94 | 94 |
ctx := context.Background() |
| 95 | 95 |
|
| 96 | 96 |
// check the container is created with private ipc mode as per daemon default |
| 97 |
- cID := container.Run(t, ctx, c, |
|
| 97 |
+ cID := container.Run(ctx, t, c, |
|
| 98 | 98 |
container.WithCmd("top"),
|
| 99 | 99 |
container.WithRestartPolicy("always"),
|
| 100 | 100 |
) |
| ... | ... |
@@ -113,7 +113,7 @@ func TestDaemonRestartIpcMode(t *testing.T) {
|
| 113 | 113 |
assert.Check(t, is.Equal(string(inspect.HostConfig.IpcMode), "private")) |
| 114 | 114 |
|
| 115 | 115 |
// check a new container is created with shareable ipc mode as per new daemon default |
| 116 |
- cID = container.Run(t, ctx, c) |
|
| 116 |
+ cID = container.Run(ctx, t, c) |
|
| 117 | 117 |
defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
|
| 118 | 118 |
|
| 119 | 119 |
inspect, err = c.ContainerInspect(ctx, cID) |
| ... | ... |
@@ -19,7 +19,7 @@ func TestDiff(t *testing.T) {
|
| 19 | 19 |
client := testEnv.APIClient() |
| 20 | 20 |
ctx := context.Background() |
| 21 | 21 |
|
| 22 |
- cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))
|
|
| 22 |
+ cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))
|
|
| 23 | 23 |
|
| 24 | 24 |
// Wait for it to exit as cannot diff a running container on Windows, and |
| 25 | 25 |
// it will take a few seconds to exit. Also there's no way in Windows to |
| ... | ... |
@@ -24,7 +24,7 @@ func TestExecWithCloseStdin(t *testing.T) {
|
| 24 | 24 |
client := testEnv.APIClient() |
| 25 | 25 |
|
| 26 | 26 |
// run top with detached mode |
| 27 |
- cID := container.Run(t, ctx, client) |
|
| 27 |
+ cID := container.Run(ctx, t, client) |
|
| 28 | 28 |
|
| 29 | 29 |
expected := "closeIO" |
| 30 | 30 |
execResp, err := client.ContainerExecCreate(ctx, cID, |
| ... | ... |
@@ -90,7 +90,7 @@ func TestExec(t *testing.T) {
|
| 90 | 90 |
ctx := context.Background() |
| 91 | 91 |
client := testEnv.APIClient() |
| 92 | 92 |
|
| 93 |
- cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/root"))
|
|
| 93 |
+ cID := container.Run(ctx, t, client, container.WithTty(true), container.WithWorkingDir("/root"))
|
|
| 94 | 94 |
|
| 95 | 95 |
id, err := client.ContainerExecCreate(ctx, cID, |
| 96 | 96 |
types.ExecConfig{
|
| ... | ... |
@@ -125,7 +125,7 @@ func TestExecUser(t *testing.T) {
|
| 125 | 125 |
ctx := context.Background() |
| 126 | 126 |
client := testEnv.APIClient() |
| 127 | 127 |
|
| 128 |
- cID := container.Run(t, ctx, client, container.WithTty(true), container.WithUser("1:1"))
|
|
| 128 |
+ cID := container.Run(ctx, t, client, container.WithTty(true), container.WithUser("1:1"))
|
|
| 129 | 129 |
|
| 130 | 130 |
result, err := container.Exec(ctx, client, cID, []string{"id"})
|
| 131 | 131 |
assert.NilError(t, err) |
| ... | ... |
@@ -25,7 +25,7 @@ func TestExportContainerAndImportImage(t *testing.T) {
|
| 25 | 25 |
client := testEnv.APIClient() |
| 26 | 26 |
ctx := context.Background() |
| 27 | 27 |
|
| 28 |
- cID := container.Run(t, ctx, client, container.WithCmd("true"))
|
|
| 28 |
+ cID := container.Run(ctx, t, client, container.WithCmd("true"))
|
|
| 29 | 29 |
poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond)) |
| 30 | 30 |
|
| 31 | 31 |
reference := "repo/testexp:v1" |
| ... | ... |
@@ -67,7 +67,7 @@ func TestExportContainerAfterDaemonRestart(t *testing.T) {
|
| 67 | 67 |
defer d.Stop(t) |
| 68 | 68 |
|
| 69 | 69 |
ctx := context.Background() |
| 70 |
- ctrID := container.Create(t, ctx, c) |
|
| 70 |
+ ctrID := container.Create(ctx, t, c) |
|
| 71 | 71 |
|
| 72 | 72 |
d.Restart(t) |
| 73 | 73 |
|
| ... | ... |
@@ -22,7 +22,7 @@ func TestHealthCheckWorkdir(t *testing.T) {
|
| 22 | 22 |
ctx := context.Background() |
| 23 | 23 |
client := testEnv.APIClient() |
| 24 | 24 |
|
| 25 |
- cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
|
|
| 25 |
+ cID := container.Run(ctx, t, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
|
|
| 26 | 26 |
c.Config.Healthcheck = &containertypes.HealthConfig{
|
| 27 | 27 |
Test: []string{"CMD-SHELL", "if [ \"$PWD\" = \"/foo\" ]; then exit 0; else exit 1; fi;"},
|
| 28 | 28 |
Interval: 50 * time.Millisecond, |
| ... | ... |
@@ -42,7 +42,7 @@ func TestHealthKillContainer(t *testing.T) {
|
| 42 | 42 |
ctx := context.Background() |
| 43 | 43 |
client := testEnv.APIClient() |
| 44 | 44 |
|
| 45 |
- id := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
|
| 45 |
+ id := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
|
|
| 46 | 46 |
c.Config.Healthcheck = &containertypes.HealthConfig{
|
| 47 | 47 |
Test: []string{"CMD-SHELL", "sleep 1"},
|
| 48 | 48 |
Interval: time.Second, |
| ... | ... |
@@ -24,7 +24,7 @@ func TestInspectCpusetInConfigPre120(t *testing.T) {
|
| 24 | 24 |
|
| 25 | 25 |
name := "cpusetinconfig-pre120-" + t.Name() |
| 26 | 26 |
// Create container with up to-date-API |
| 27 |
- container.Run(t, ctx, request.NewAPIClient(t), container.WithName(name), |
|
| 27 |
+ container.Run(ctx, t, request.NewAPIClient(t), container.WithName(name), |
|
| 28 | 28 |
container.WithCmd("true"),
|
| 29 | 29 |
func(c *container.TestContainerConfig) {
|
| 30 | 30 |
c.HostConfig.Resources.CpusetCpus = "0" |
| ... | ... |
@@ -308,7 +308,7 @@ func TestIpcModeOlderClient(t *testing.T) {
|
| 308 | 308 |
ctx := context.Background() |
| 309 | 309 |
|
| 310 | 310 |
// pre-check: default ipc mode in daemon is private |
| 311 |
- cID := container.Create(t, ctx, c, container.WithAutoRemove) |
|
| 311 |
+ cID := container.Create(ctx, t, c, container.WithAutoRemove) |
|
| 312 | 312 |
|
| 313 | 313 |
inspect, err := c.ContainerInspect(ctx, cID) |
| 314 | 314 |
assert.NilError(t, err) |
| ... | ... |
@@ -316,7 +316,7 @@ func TestIpcModeOlderClient(t *testing.T) {
|
| 316 | 316 |
|
| 317 | 317 |
// main check: using older client creates "shareable" container |
| 318 | 318 |
c = request.NewAPIClient(t, client.WithVersion("1.39"))
|
| 319 |
- cID = container.Create(t, ctx, c, container.WithAutoRemove) |
|
| 319 |
+ cID = container.Create(ctx, t, c, container.WithAutoRemove) |
|
| 320 | 320 |
|
| 321 | 321 |
inspect, err = c.ContainerInspect(ctx, cID) |
| 322 | 322 |
assert.NilError(t, err) |
| ... | ... |
@@ -18,7 +18,7 @@ func TestKillContainerInvalidSignal(t *testing.T) {
|
| 18 | 18 |
defer setupTest(t)() |
| 19 | 19 |
client := testEnv.APIClient() |
| 20 | 20 |
ctx := context.Background() |
| 21 |
- id := container.Run(t, ctx, client) |
|
| 21 |
+ id := container.Run(ctx, t, client) |
|
| 22 | 22 |
|
| 23 | 23 |
err := client.ContainerKill(ctx, id, "0") |
| 24 | 24 |
assert.Error(t, err, "Error response from daemon: Invalid signal: 0") |
| ... | ... |
@@ -60,7 +60,7 @@ func TestKillContainer(t *testing.T) {
|
| 60 | 60 |
tc := tc |
| 61 | 61 |
t.Run(tc.doc, func(t *testing.T) {
|
| 62 | 62 |
ctx := context.Background() |
| 63 |
- id := container.Run(t, ctx, client) |
|
| 63 |
+ id := container.Run(ctx, t, client) |
|
| 64 | 64 |
err := client.ContainerKill(ctx, id, tc.signal) |
| 65 | 65 |
assert.NilError(t, err) |
| 66 | 66 |
|
| ... | ... |
@@ -95,7 +95,7 @@ func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
|
| 95 | 95 |
tc := tc |
| 96 | 96 |
t.Run(tc.doc, func(t *testing.T) {
|
| 97 | 97 |
ctx := context.Background() |
| 98 |
- id := container.Run(t, ctx, client, |
|
| 98 |
+ id := container.Run(ctx, t, client, |
|
| 99 | 99 |
container.WithRestartPolicy("always"),
|
| 100 | 100 |
func(c *container.TestContainerConfig) {
|
| 101 | 101 |
c.Config.StopSignal = tc.stopsignal |
| ... | ... |
@@ -113,7 +113,7 @@ func TestKillStoppedContainer(t *testing.T) {
|
| 113 | 113 |
defer setupTest(t)() |
| 114 | 114 |
ctx := context.Background() |
| 115 | 115 |
client := testEnv.APIClient() |
| 116 |
- id := container.Create(t, ctx, client) |
|
| 116 |
+ id := container.Create(ctx, t, client) |
|
| 117 | 117 |
err := client.ContainerKill(ctx, id, "SIGKILL") |
| 118 | 118 |
assert.Assert(t, is.ErrorContains(err, "")) |
| 119 | 119 |
assert.Assert(t, is.Contains(err.Error(), "is not running")) |
| ... | ... |
@@ -124,7 +124,7 @@ func TestKillStoppedContainerAPIPre120(t *testing.T) {
|
| 124 | 124 |
defer setupTest(t)() |
| 125 | 125 |
ctx := context.Background() |
| 126 | 126 |
client := request.NewAPIClient(t, client.WithVersion("1.19"))
|
| 127 |
- id := container.Create(t, ctx, client) |
|
| 127 |
+ id := container.Create(ctx, t, client) |
|
| 128 | 128 |
err := client.ContainerKill(ctx, id, "SIGKILL") |
| 129 | 129 |
assert.NilError(t, err) |
| 130 | 130 |
} |
| ... | ... |
@@ -137,7 +137,7 @@ func TestKillDifferentUserContainer(t *testing.T) {
|
| 137 | 137 |
ctx := context.Background() |
| 138 | 138 |
client := request.NewAPIClient(t, client.WithVersion("1.19"))
|
| 139 | 139 |
|
| 140 |
- id := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
|
| 140 |
+ id := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
|
|
| 141 | 141 |
c.Config.User = "daemon" |
| 142 | 142 |
}) |
| 143 | 143 |
poll.WaitOn(t, container.IsInState(ctx, client, id, "running"), poll.WithDelay(100*time.Millisecond)) |
| ... | ... |
@@ -154,7 +154,7 @@ func TestInspectOomKilledTrue(t *testing.T) {
|
| 154 | 154 |
ctx := context.Background() |
| 155 | 155 |
client := testEnv.APIClient() |
| 156 | 156 |
|
| 157 |
- cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "x=a; while true; do x=$x$x$x$x; done"), func(c *container.TestContainerConfig) {
|
|
| 157 |
+ cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "x=a; while true; do x=$x$x$x$x; done"), func(c *container.TestContainerConfig) {
|
|
| 158 | 158 |
c.HostConfig.Resources.Memory = 32 * 1024 * 1024 |
| 159 | 159 |
}) |
| 160 | 160 |
|
| ... | ... |
@@ -172,7 +172,7 @@ func TestInspectOomKilledFalse(t *testing.T) {
|
| 172 | 172 |
ctx := context.Background() |
| 173 | 173 |
client := testEnv.APIClient() |
| 174 | 174 |
|
| 175 |
- cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "echo hello world"))
|
|
| 175 |
+ cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "echo hello world"))
|
|
| 176 | 176 |
|
| 177 | 177 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond)) |
| 178 | 178 |
|
| ... | ... |
@@ -24,7 +24,7 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
|
| 24 | 24 |
client := testEnv.APIClient() |
| 25 | 25 |
ctx := context.Background() |
| 26 | 26 |
|
| 27 |
- cID := container.Run(t, ctx, client, container.WithNetworkMode("host"))
|
|
| 27 |
+ cID := container.Run(ctx, t, client, container.WithNetworkMode("host"))
|
|
| 28 | 28 |
res, err := container.Exec(ctx, client, cID, []string{"cat", "/etc/hosts"})
|
| 29 | 29 |
assert.NilError(t, err) |
| 30 | 30 |
assert.Assert(t, is.Len(res.Stderr(), 0)) |
| ... | ... |
@@ -42,8 +42,8 @@ func TestLinksContainerNames(t *testing.T) {
|
| 42 | 42 |
|
| 43 | 43 |
containerA := "first_" + t.Name() |
| 44 | 44 |
containerB := "second_" + t.Name() |
| 45 |
- container.Run(t, ctx, client, container.WithName(containerA)) |
|
| 46 |
- container.Run(t, ctx, client, container.WithName(containerB), container.WithLinks(containerA+":"+containerA)) |
|
| 45 |
+ container.Run(ctx, t, client, container.WithName(containerA)) |
|
| 46 |
+ container.Run(ctx, t, client, container.WithName(containerB), container.WithLinks(containerA+":"+containerA)) |
|
| 47 | 47 |
|
| 48 | 48 |
f := filters.NewArgs(filters.Arg("name", containerA))
|
| 49 | 49 |
|
| ... | ... |
@@ -21,7 +21,7 @@ func TestLogsFollowTailEmpty(t *testing.T) {
|
| 21 | 21 |
client := testEnv.APIClient() |
| 22 | 22 |
ctx := context.Background() |
| 23 | 23 |
|
| 24 |
- id := container.Run(t, ctx, client, container.WithCmd("sleep", "100000"))
|
|
| 24 |
+ id := container.Run(ctx, t, client, container.WithCmd("sleep", "100000"))
|
|
| 25 | 25 |
|
| 26 | 26 |
logs, err := client.ContainerLogs(ctx, id, types.ContainerLogsOptions{ShowStdout: true, Tail: "2"})
|
| 27 | 27 |
if logs != nil {
|
| ... | ... |
@@ -256,9 +256,9 @@ func TestContainerBindMountNonRecursive(t *testing.T) {
|
| 256 | 256 |
ctx := context.Background() |
| 257 | 257 |
client := testEnv.APIClient() |
| 258 | 258 |
containers := []string{
|
| 259 |
- container.Run(t, ctx, client, container.WithMount(implicit), container.WithCmd(recursiveVerifier...)), |
|
| 260 |
- container.Run(t, ctx, client, container.WithMount(recursive), container.WithCmd(recursiveVerifier...)), |
|
| 261 |
- container.Run(t, ctx, client, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)), |
|
| 259 |
+ container.Run(ctx, t, client, container.WithMount(implicit), container.WithCmd(recursiveVerifier...)), |
|
| 260 |
+ container.Run(ctx, t, client, container.WithMount(recursive), container.WithCmd(recursiveVerifier...)), |
|
| 261 |
+ container.Run(ctx, t, client, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)), |
|
| 262 | 262 |
} |
| 263 | 263 |
|
| 264 | 264 |
for _, c := range containers {
|
| ... | ... |
@@ -71,7 +71,7 @@ func TestNetworkLoopbackNat(t *testing.T) {
|
| 71 | 71 |
client := testEnv.APIClient() |
| 72 | 72 |
ctx := context.Background() |
| 73 | 73 |
|
| 74 |
- cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", fmt.Sprintf("stty raw && nc -w 5 %s 8080", endpoint.String())), container.WithTty(true), container.WithNetworkMode("container:"+serverContainerID))
|
|
| 74 |
+ cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", fmt.Sprintf("stty raw && nc -w 5 %s 8080", endpoint.String())), container.WithTty(true), container.WithNetworkMode("container:"+serverContainerID))
|
|
| 75 | 75 |
|
| 76 | 76 |
poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond)) |
| 77 | 77 |
|
| ... | ... |
@@ -93,7 +93,7 @@ func startServerContainer(t *testing.T, msg string, port int) string {
|
| 93 | 93 |
client := testEnv.APIClient() |
| 94 | 94 |
ctx := context.Background() |
| 95 | 95 |
|
| 96 |
- cID := container.Run(t, ctx, client, container.WithName("server-"+t.Name()), container.WithCmd("sh", "-c", fmt.Sprintf("echo %q | nc -lp %d", msg, port)), container.WithExposedPorts(fmt.Sprintf("%d/tcp", port)), func(c *container.TestContainerConfig) {
|
|
| 96 |
+ cID := container.Run(ctx, t, client, container.WithName("server-"+t.Name()), container.WithCmd("sh", "-c", fmt.Sprintf("echo %q | nc -lp %d", msg, port)), container.WithExposedPorts(fmt.Sprintf("%d/tcp", port)), func(c *container.TestContainerConfig) {
|
|
| 97 | 97 |
c.HostConfig.PortBindings = nat.PortMap{
|
| 98 | 98 |
nat.Port(fmt.Sprintf("%d/tcp", port)): []nat.PortBinding{
|
| 99 | 99 |
{
|
| ... | ... |
@@ -25,7 +25,7 @@ func TestPause(t *testing.T) {
|
| 25 | 25 |
client := testEnv.APIClient() |
| 26 | 26 |
ctx := context.Background() |
| 27 | 27 |
|
| 28 |
- cID := container.Run(t, ctx, client) |
|
| 28 |
+ cID := container.Run(ctx, t, client) |
|
| 29 | 29 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 30 | 30 |
|
| 31 | 31 |
since := request.DaemonUnixTime(ctx, t, client, testEnv) |
| ... | ... |
@@ -57,7 +57,7 @@ func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
|
| 57 | 57 |
client := testEnv.APIClient() |
| 58 | 58 |
ctx := context.Background() |
| 59 | 59 |
|
| 60 |
- cID := container.Run(t, ctx, client) |
|
| 60 |
+ cID := container.Run(ctx, t, client) |
|
| 61 | 61 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 62 | 62 |
|
| 63 | 63 |
err := client.ContainerPause(ctx, cID) |
| ... | ... |
@@ -71,7 +71,7 @@ func TestPauseStopPausedContainer(t *testing.T) {
|
| 71 | 71 |
client := testEnv.APIClient() |
| 72 | 72 |
ctx := context.Background() |
| 73 | 73 |
|
| 74 |
- cID := container.Run(t, ctx, client) |
|
| 74 |
+ cID := container.Run(ctx, t, client) |
|
| 75 | 75 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 76 | 76 |
|
| 77 | 77 |
err := client.ContainerPause(ctx, cID) |
| ... | ... |
@@ -16,9 +16,9 @@ func TestPsFilter(t *testing.T) {
|
| 16 | 16 |
client := testEnv.APIClient() |
| 17 | 17 |
ctx := context.Background() |
| 18 | 18 |
|
| 19 |
- prev := container.Create(t, ctx, client) |
|
| 20 |
- top := container.Create(t, ctx, client) |
|
| 21 |
- next := container.Create(t, ctx, client) |
|
| 19 |
+ prev := container.Create(ctx, t, client) |
|
| 20 |
+ top := container.Create(ctx, t, client) |
|
| 21 |
+ next := container.Create(ctx, t, client) |
|
| 22 | 22 |
|
| 23 | 23 |
containerIDs := func(containers []types.Container) []string {
|
| 24 | 24 |
var entries []string |
| ... | ... |
@@ -36,7 +36,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
|
| 36 | 36 |
tempDir := fs.NewDir(t, "test-rm-container-with-removed-volume", fs.WithMode(0755)) |
| 37 | 37 |
defer tempDir.Remove() |
| 38 | 38 |
|
| 39 |
- cID := container.Run(t, ctx, client, container.WithCmd("true"), container.WithBind(tempDir.Path(), prefix+slash+"test"))
|
|
| 39 |
+ cID := container.Run(ctx, t, client, container.WithCmd("true"), container.WithBind(tempDir.Path(), prefix+slash+"test"))
|
|
| 40 | 40 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond)) |
| 41 | 41 |
|
| 42 | 42 |
err := os.RemoveAll(tempDir.Path()) |
| ... | ... |
@@ -59,7 +59,7 @@ func TestRemoveContainerWithVolume(t *testing.T) {
|
| 59 | 59 |
|
| 60 | 60 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
| 61 | 61 |
|
| 62 |
- cID := container.Run(t, ctx, client, container.WithCmd("true"), container.WithVolume(prefix+slash+"srv"))
|
|
| 62 |
+ cID := container.Run(ctx, t, client, container.WithCmd("true"), container.WithVolume(prefix+slash+"srv"))
|
|
| 63 | 63 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond)) |
| 64 | 64 |
|
| 65 | 65 |
insp, _, err := client.ContainerInspectWithRaw(ctx, cID, true) |
| ... | ... |
@@ -82,7 +82,7 @@ func TestRemoveContainerRunning(t *testing.T) {
|
| 82 | 82 |
ctx := context.Background() |
| 83 | 83 |
client := testEnv.APIClient() |
| 84 | 84 |
|
| 85 |
- cID := container.Run(t, ctx, client) |
|
| 85 |
+ cID := container.Run(ctx, t, client) |
|
| 86 | 86 |
|
| 87 | 87 |
err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{})
|
| 88 | 88 |
assert.Check(t, is.ErrorContains(err, "cannot remove a running container")) |
| ... | ... |
@@ -93,7 +93,7 @@ func TestRemoveContainerForceRemoveRunning(t *testing.T) {
|
| 93 | 93 |
ctx := context.Background() |
| 94 | 94 |
client := testEnv.APIClient() |
| 95 | 95 |
|
| 96 |
- cID := container.Run(t, ctx, client) |
|
| 96 |
+ cID := container.Run(ctx, t, client) |
|
| 97 | 97 |
|
| 98 | 98 |
err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
|
| 99 | 99 |
Force: true, |
| ... | ... |
@@ -30,18 +30,18 @@ func TestRenameLinkedContainer(t *testing.T) {
|
| 30 | 30 |
|
| 31 | 31 |
aName := "a0" + t.Name() |
| 32 | 32 |
bName := "b0" + t.Name() |
| 33 |
- aID := container.Run(t, ctx, client, container.WithName(aName)) |
|
| 34 |
- bID := container.Run(t, ctx, client, container.WithName(bName), container.WithLinks(aName)) |
|
| 33 |
+ aID := container.Run(ctx, t, client, container.WithName(aName)) |
|
| 34 |
+ bID := container.Run(ctx, t, client, container.WithName(bName), container.WithLinks(aName)) |
|
| 35 | 35 |
|
| 36 | 36 |
err := client.ContainerRename(ctx, aID, "a1"+t.Name()) |
| 37 | 37 |
assert.NilError(t, err) |
| 38 | 38 |
|
| 39 |
- container.Run(t, ctx, client, container.WithName(aName)) |
|
| 39 |
+ container.Run(ctx, t, client, container.WithName(aName)) |
|
| 40 | 40 |
|
| 41 | 41 |
err = client.ContainerRemove(ctx, bID, types.ContainerRemoveOptions{Force: true})
|
| 42 | 42 |
assert.NilError(t, err) |
| 43 | 43 |
|
| 44 |
- bID = container.Run(t, ctx, client, container.WithName(bName), container.WithLinks(aName)) |
|
| 44 |
+ bID = container.Run(ctx, t, client, container.WithName(bName), container.WithLinks(aName)) |
|
| 45 | 45 |
|
| 46 | 46 |
inspect, err := client.ContainerInspect(ctx, bID) |
| 47 | 47 |
assert.NilError(t, err) |
| ... | ... |
@@ -54,7 +54,7 @@ func TestRenameStoppedContainer(t *testing.T) {
|
| 54 | 54 |
client := testEnv.APIClient() |
| 55 | 55 |
|
| 56 | 56 |
oldName := "first_name" + t.Name() |
| 57 |
- cID := container.Run(t, ctx, client, container.WithName(oldName), container.WithCmd("sh"))
|
|
| 57 |
+ cID := container.Run(ctx, t, client, container.WithName(oldName), container.WithCmd("sh"))
|
|
| 58 | 58 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond)) |
| 59 | 59 |
|
| 60 | 60 |
inspect, err := client.ContainerInspect(ctx, cID) |
| ... | ... |
@@ -76,7 +76,7 @@ func TestRenameRunningContainerAndReuse(t *testing.T) {
|
| 76 | 76 |
client := testEnv.APIClient() |
| 77 | 77 |
|
| 78 | 78 |
oldName := "first_name" + t.Name() |
| 79 |
- cID := container.Run(t, ctx, client, container.WithName(oldName)) |
|
| 79 |
+ cID := container.Run(ctx, t, client, container.WithName(oldName)) |
|
| 80 | 80 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 81 | 81 |
|
| 82 | 82 |
newName := "new_name" + stringid.GenerateRandomID() |
| ... | ... |
@@ -90,7 +90,7 @@ func TestRenameRunningContainerAndReuse(t *testing.T) {
|
| 90 | 90 |
_, err = client.ContainerInspect(ctx, oldName) |
| 91 | 91 |
assert.Check(t, is.ErrorContains(err, "No such container: "+oldName)) |
| 92 | 92 |
|
| 93 |
- cID = container.Run(t, ctx, client, container.WithName(oldName)) |
|
| 93 |
+ cID = container.Run(ctx, t, client, container.WithName(oldName)) |
|
| 94 | 94 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 95 | 95 |
|
| 96 | 96 |
inspect, err = client.ContainerInspect(ctx, cID) |
| ... | ... |
@@ -104,7 +104,7 @@ func TestRenameInvalidName(t *testing.T) {
|
| 104 | 104 |
client := testEnv.APIClient() |
| 105 | 105 |
|
| 106 | 106 |
oldName := "first_name" + t.Name() |
| 107 |
- cID := container.Run(t, ctx, client, container.WithName(oldName)) |
|
| 107 |
+ cID := container.Run(ctx, t, client, container.WithName(oldName)) |
|
| 108 | 108 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 109 | 109 |
|
| 110 | 110 |
err := client.ContainerRename(ctx, oldName, "new:invalid") |
| ... | ... |
@@ -132,7 +132,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
|
| 132 | 132 |
_, err := client.NetworkCreate(ctx, networkName, types.NetworkCreate{})
|
| 133 | 133 |
|
| 134 | 134 |
assert.NilError(t, err) |
| 135 |
- cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
|
| 135 |
+ cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
|
|
| 136 | 136 |
c.NetworkingConfig.EndpointsConfig = map[string]*network.EndpointSettings{
|
| 137 | 137 |
networkName: {},
|
| 138 | 138 |
} |
| ... | ... |
@@ -155,7 +155,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
|
| 155 | 155 |
if testEnv.OSType == "windows" {
|
| 156 | 156 |
count = "-n" |
| 157 | 157 |
} |
| 158 |
- cID = container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
|
| 158 |
+ cID = container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
|
|
| 159 | 159 |
c.NetworkingConfig.EndpointsConfig = map[string]*network.EndpointSettings{
|
| 160 | 160 |
networkName: {},
|
| 161 | 161 |
} |
| ... | ... |
@@ -175,7 +175,7 @@ func TestRenameContainerWithSameName(t *testing.T) {
|
| 175 | 175 |
client := testEnv.APIClient() |
| 176 | 176 |
|
| 177 | 177 |
oldName := "old" + t.Name() |
| 178 |
- cID := container.Run(t, ctx, client, container.WithName(oldName)) |
|
| 178 |
+ cID := container.Run(ctx, t, client, container.WithName(oldName)) |
|
| 179 | 179 |
|
| 180 | 180 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 181 | 181 |
err := client.ContainerRename(ctx, oldName, oldName) |
| ... | ... |
@@ -198,12 +198,12 @@ func TestRenameContainerWithLinkedContainer(t *testing.T) {
|
| 198 | 198 |
client := testEnv.APIClient() |
| 199 | 199 |
|
| 200 | 200 |
db1Name := "db1" + t.Name() |
| 201 |
- db1ID := container.Run(t, ctx, client, container.WithName(db1Name)) |
|
| 201 |
+ db1ID := container.Run(ctx, t, client, container.WithName(db1Name)) |
|
| 202 | 202 |
poll.WaitOn(t, container.IsInState(ctx, client, db1ID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 203 | 203 |
|
| 204 | 204 |
app1Name := "app1" + t.Name() |
| 205 | 205 |
app2Name := "app2" + t.Name() |
| 206 |
- app1ID := container.Run(t, ctx, client, container.WithName(app1Name), container.WithLinks(db1Name+":/mysql")) |
|
| 206 |
+ app1ID := container.Run(ctx, t, client, container.WithName(app1Name), container.WithLinks(db1Name+":/mysql")) |
|
| 207 | 207 |
poll.WaitOn(t, container.IsInState(ctx, client, app1ID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 208 | 208 |
|
| 209 | 209 |
err := client.ContainerRename(ctx, app1Name, app2Name) |
| ... | ... |
@@ -22,7 +22,7 @@ func TestResize(t *testing.T) {
|
| 22 | 22 |
client := testEnv.APIClient() |
| 23 | 23 |
ctx := context.Background() |
| 24 | 24 |
|
| 25 |
- cID := container.Run(t, ctx, client) |
|
| 25 |
+ cID := container.Run(ctx, t, client) |
|
| 26 | 26 |
|
| 27 | 27 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 28 | 28 |
|
| ... | ... |
@@ -40,7 +40,7 @@ func TestResizeWithInvalidSize(t *testing.T) {
|
| 40 | 40 |
client := testEnv.APIClient() |
| 41 | 41 |
ctx := context.Background() |
| 42 | 42 |
|
| 43 |
- cID := container.Run(t, ctx, client) |
|
| 43 |
+ cID := container.Run(ctx, t, client) |
|
| 44 | 44 |
|
| 45 | 45 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 46 | 46 |
|
| ... | ... |
@@ -55,7 +55,7 @@ func TestResizeWhenContainerNotStarted(t *testing.T) {
|
| 55 | 55 |
client := testEnv.APIClient() |
| 56 | 56 |
ctx := context.Background() |
| 57 | 57 |
|
| 58 |
- cID := container.Run(t, ctx, client, container.WithCmd("echo"))
|
|
| 58 |
+ cID := container.Run(ctx, t, client, container.WithCmd("echo"))
|
|
| 59 | 59 |
|
| 60 | 60 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond)) |
| 61 | 61 |
|
| ... | ... |
@@ -29,7 +29,7 @@ func TestKernelTCPMemory(t *testing.T) {
|
| 29 | 29 |
kernelMemoryTCP int64 = 200 * 1024 * 1024 |
| 30 | 30 |
) |
| 31 | 31 |
|
| 32 |
- cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
|
| 32 |
+ cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
|
|
| 33 | 33 |
c.HostConfig.Resources = containertypes.Resources{
|
| 34 | 34 |
KernelMemoryTCP: kernelMemoryTCP, |
| 35 | 35 |
} |
| ... | ... |
@@ -65,7 +65,7 @@ func TestNISDomainname(t *testing.T) {
|
| 65 | 65 |
domainname = "baz.cyphar.com" |
| 66 | 66 |
) |
| 67 | 67 |
|
| 68 |
- cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
|
| 68 |
+ cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
|
|
| 69 | 69 |
c.Config.Hostname = hostname |
| 70 | 70 |
c.Config.Domainname = domainname |
| 71 | 71 |
}) |
| ... | ... |
@@ -25,7 +25,7 @@ func TestStats(t *testing.T) {
|
| 25 | 25 |
info, err := client.Info(ctx) |
| 26 | 26 |
assert.NilError(t, err) |
| 27 | 27 |
|
| 28 |
- cID := container.Run(t, ctx, client) |
|
| 28 |
+ cID := container.Run(ctx, t, client) |
|
| 29 | 29 |
|
| 30 | 30 |
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) |
| 31 | 31 |
|
| ... | ... |
@@ -54,7 +54,7 @@ func TestStopContainerWithTimeout(t *testing.T) {
|
| 54 | 54 |
d := d |
| 55 | 55 |
t.Run(strconv.Itoa(d.timeout), func(t *testing.T) {
|
| 56 | 56 |
t.Parallel() |
| 57 |
- id := container.Run(t, ctx, client, testCmd) |
|
| 57 |
+ id := container.Run(ctx, t, client, testCmd) |
|
| 58 | 58 |
|
| 59 | 59 |
timeout := time.Duration(d.timeout) * time.Second |
| 60 | 60 |
err := client.ContainerStop(ctx, id, &timeout) |
| ... | ... |
@@ -78,7 +78,7 @@ func TestDeleteDevicemapper(t *testing.T) {
|
| 78 | 78 |
client := testEnv.APIClient() |
| 79 | 79 |
ctx := context.Background() |
| 80 | 80 |
|
| 81 |
- id := container.Run(t, ctx, client, container.WithName("foo-"+t.Name()), container.WithCmd("echo"))
|
|
| 81 |
+ id := container.Run(ctx, t, client, container.WithName("foo-"+t.Name()), container.WithCmd("echo"))
|
|
| 82 | 82 |
|
| 83 | 83 |
poll.WaitOn(t, container.IsStopped(ctx, client, id), poll.WithDelay(100*time.Millisecond)) |
| 84 | 84 |
|
| ... | ... |
@@ -17,7 +17,7 @@ func TestStopContainerWithRestartPolicyAlways(t *testing.T) {
|
| 17 | 17 |
|
| 18 | 18 |
names := []string{"verifyRestart1-" + t.Name(), "verifyRestart2-" + t.Name()}
|
| 19 | 19 |
for _, name := range names {
|
| 20 |
- container.Run(t, ctx, client, |
|
| 20 |
+ container.Run(ctx, t, client, |
|
| 21 | 21 |
container.WithName(name), |
| 22 | 22 |
container.WithCmd("false"),
|
| 23 | 23 |
container.WithRestartPolicy("always"),
|
| ... | ... |
@@ -51,7 +51,7 @@ func TestStopContainerWithTimeout(t *testing.T) {
|
| 51 | 51 |
d := d |
| 52 | 52 |
t.Run(strconv.Itoa(d.timeout), func(t *testing.T) {
|
| 53 | 53 |
t.Parallel() |
| 54 |
- id := container.Run(t, ctx, client, testCmd) |
|
| 54 |
+ id := container.Run(ctx, t, client, testCmd) |
|
| 55 | 55 |
|
| 56 | 56 |
timeout := time.Duration(d.timeout) * time.Second |
| 57 | 57 |
err := client.ContainerStop(ctx, id, &timeout) |
| ... | ... |
@@ -26,7 +26,7 @@ func TestUpdateMemory(t *testing.T) {
|
| 26 | 26 |
client := testEnv.APIClient() |
| 27 | 27 |
ctx := context.Background() |
| 28 | 28 |
|
| 29 |
- cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
|
| 29 |
+ cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
|
|
| 30 | 30 |
c.HostConfig.Resources = containertypes.Resources{
|
| 31 | 31 |
Memory: 200 * 1024 * 1024, |
| 32 | 32 |
} |
| ... | ... |
@@ -72,7 +72,7 @@ func TestUpdateCPUQuota(t *testing.T) {
|
| 72 | 72 |
client := testEnv.APIClient() |
| 73 | 73 |
ctx := context.Background() |
| 74 | 74 |
|
| 75 |
- cID := container.Run(t, ctx, client) |
|
| 75 |
+ cID := container.Run(ctx, t, client) |
|
| 76 | 76 |
|
| 77 | 77 |
for _, test := range []struct {
|
| 78 | 78 |
desc string |
| ... | ... |
@@ -140,7 +140,7 @@ func TestUpdatePidsLimit(t *testing.T) {
|
| 140 | 140 |
|
| 141 | 141 |
t.Run(test.desc, func(t *testing.T) {
|
| 142 | 142 |
// Using "network=host" to speed up creation (13.96s vs 6.54s) |
| 143 |
- cID := container.Run(t, ctx, apiClient, container.WithPidsLimit(test.initial), container.WithNetworkMode("host"))
|
|
| 143 |
+ cID := container.Run(ctx, t, apiClient, container.WithPidsLimit(test.initial), container.WithNetworkMode("host"))
|
|
| 144 | 144 |
|
| 145 | 145 |
_, err := c.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
|
| 146 | 146 |
Resources: containertypes.Resources{
|
| ... | ... |
@@ -17,7 +17,7 @@ func TestUpdateRestartPolicy(t *testing.T) {
|
| 17 | 17 |
client := testEnv.APIClient() |
| 18 | 18 |
ctx := context.Background() |
| 19 | 19 |
|
| 20 |
- cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "sleep 1 && false"), func(c *container.TestContainerConfig) {
|
|
| 20 |
+ cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "sleep 1 && false"), func(c *container.TestContainerConfig) {
|
|
| 21 | 21 |
c.HostConfig.RestartPolicy = containertypes.RestartPolicy{
|
| 22 | 22 |
Name: "on-failure", |
| 23 | 23 |
MaximumRetryCount: 3, |
| ... | ... |
@@ -50,7 +50,7 @@ func TestUpdateRestartWithAutoRemove(t *testing.T) {
|
| 50 | 50 |
client := testEnv.APIClient() |
| 51 | 51 |
ctx := context.Background() |
| 52 | 52 |
|
| 53 |
- cID := container.Run(t, ctx, client, container.WithAutoRemove) |
|
| 53 |
+ cID := container.Run(ctx, t, client, container.WithAutoRemove) |
|
| 54 | 54 |
|
| 55 | 55 |
_, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
|
| 56 | 56 |
RestartPolicy: containertypes.RestartPolicy{
|
| ... | ... |
@@ -39,7 +39,7 @@ func TestWaitNonBlocked(t *testing.T) {
|
| 39 | 39 |
t.Run(tc.doc, func(t *testing.T) {
|
| 40 | 40 |
t.Parallel() |
| 41 | 41 |
ctx := context.Background() |
| 42 |
- containerID := container.Run(t, ctx, cli, container.WithCmd("sh", "-c", tc.cmd))
|
|
| 42 |
+ containerID := container.Run(ctx, t, cli, container.WithCmd("sh", "-c", tc.cmd))
|
|
| 43 | 43 |
poll.WaitOn(t, container.IsInState(ctx, cli, containerID, "exited"), poll.WithTimeout(30*time.Second), poll.WithDelay(100*time.Millisecond)) |
| 44 | 44 |
|
| 45 | 45 |
waitresC, errC := cli.ContainerWait(ctx, containerID, "") |
| ... | ... |
@@ -81,7 +81,7 @@ func TestWaitBlocked(t *testing.T) {
|
| 81 | 81 |
t.Run(tc.doc, func(t *testing.T) {
|
| 82 | 82 |
t.Parallel() |
| 83 | 83 |
ctx := context.Background() |
| 84 |
- containerID := container.Run(t, ctx, cli, container.WithCmd("sh", "-c", tc.cmd))
|
|
| 84 |
+ containerID := container.Run(ctx, t, cli, container.WithCmd("sh", "-c", tc.cmd))
|
|
| 85 | 85 |
poll.WaitOn(t, container.IsInState(ctx, cli, containerID, "running"), poll.WithTimeout(30*time.Second), poll.WithDelay(100*time.Millisecond)) |
| 86 | 86 |
|
| 87 | 87 |
waitresC, errC := cli.ContainerWait(ctx, containerID, "") |
| ... | ... |
@@ -19,7 +19,7 @@ func TestCommitInheritsEnv(t *testing.T) {
|
| 19 | 19 |
client := testEnv.APIClient() |
| 20 | 20 |
ctx := context.Background() |
| 21 | 21 |
|
| 22 |
- cID1 := container.Create(t, ctx, client) |
|
| 22 |
+ cID1 := container.Create(ctx, t, client) |
|
| 23 | 23 |
|
| 24 | 24 |
commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
|
| 25 | 25 |
Changes: []string{"ENV PATH=/bin"},
|
| ... | ... |
@@ -33,7 +33,7 @@ func TestCommitInheritsEnv(t *testing.T) {
|
| 33 | 33 |
expectedEnv1 := []string{"PATH=/bin"}
|
| 34 | 34 |
assert.Check(t, is.DeepEqual(expectedEnv1, image1.Config.Env)) |
| 35 | 35 |
|
| 36 |
- cID2 := container.Create(t, ctx, client, container.WithImage(image1.ID)) |
|
| 36 |
+ cID2 := container.Create(ctx, t, client, container.WithImage(image1.ID)) |
|
| 37 | 37 |
|
| 38 | 38 |
commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
|
| 39 | 39 |
Changes: []string{"ENV PATH=/usr/bin:$PATH"},
|
| ... | ... |
@@ -20,7 +20,7 @@ func TestRemoveImageOrphaning(t *testing.T) {
|
| 20 | 20 |
img := "test-container-orphaning" |
| 21 | 21 |
|
| 22 | 22 |
// Create a container from busybox, and commit a small change so we have a new image |
| 23 |
- cID1 := container.Create(t, ctx, client, container.WithCmd(""))
|
|
| 23 |
+ cID1 := container.Create(ctx, t, client, container.WithCmd(""))
|
|
| 24 | 24 |
commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
|
| 25 | 25 |
Changes: []string{`ENTRYPOINT ["true"]`},
|
| 26 | 26 |
Reference: img, |
| ... | ... |
@@ -33,7 +33,7 @@ func TestRemoveImageOrphaning(t *testing.T) {
|
| 33 | 33 |
assert.Check(t, is.Equal(resp.ID, commitResp1.ID)) |
| 34 | 34 |
|
| 35 | 35 |
// Create a container from created image, and commit a small change with same reference name |
| 36 |
- cID2 := container.Create(t, ctx, client, container.WithImage(img), container.WithCmd(""))
|
|
| 36 |
+ cID2 := container.Create(ctx, t, client, container.WithImage(img), container.WithCmd(""))
|
|
| 37 | 37 |
commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
|
| 38 | 38 |
Changes: []string{`LABEL Maintainer="Integration Tests"`},
|
| 39 | 39 |
Reference: img, |
| ... | ... |
@@ -22,8 +22,7 @@ type TestContainerConfig struct {
|
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 | 24 |
// Create creates a container with the specified options |
| 25 |
-// nolint: golint |
|
| 26 |
-func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
|
|
| 25 |
+func Create(ctx context.Context, t *testing.T, client client.APIClient, ops ...func(*TestContainerConfig)) string {
|
|
| 27 | 26 |
t.Helper() |
| 28 | 27 |
cmd := []string{"top"}
|
| 29 | 28 |
if runtime.GOOS == "windows" {
|
| ... | ... |
@@ -49,10 +48,9 @@ func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...f |
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
// Run creates and start a container with the specified options |
| 52 |
-// nolint: golint |
|
| 53 |
-func Run(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
|
|
| 52 |
+func Run(ctx context.Context, t *testing.T, client client.APIClient, ops ...func(*TestContainerConfig)) string {
|
|
| 54 | 53 |
t.Helper() |
| 55 |
- id := Create(t, ctx, client, ops...) |
|
| 54 |
+ id := Create(ctx, t, client, ops...) |
|
| 56 | 55 |
|
| 57 | 56 |
err := client.ContainerStart(ctx, id, types.ContainerStartOptions{})
|
| 58 | 57 |
assert.NilError(t, err) |
| ... | ... |
@@ -26,8 +26,7 @@ func Create(ctx context.Context, client client.APIClient, name string, ops ...fu |
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 | 28 |
// CreateNoError creates a network with the specified options and verifies there were no errors |
| 29 |
-// nolint: golint |
|
| 30 |
-func CreateNoError(t *testing.T, ctx context.Context, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { // nolint: golint
|
|
| 29 |
+func CreateNoError(ctx context.Context, t *testing.T, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { // nolint: golint
|
|
| 31 | 30 |
t.Helper() |
| 32 | 31 |
|
| 33 | 32 |
name, err := createNetwork(ctx, client, name, ops...) |
| ... | ... |
@@ -27,10 +27,10 @@ func containsNetwork(nws []types.NetworkResource, networkID string) bool {
|
| 27 | 27 |
// first network's ID as name. |
| 28 | 28 |
// |
| 29 | 29 |
// After successful creation, properties of all three networks is returned |
| 30 |
-func createAmbiguousNetworks(t *testing.T, ctx context.Context, client dclient.APIClient) (string, string, string) { // nolint: golint
|
|
| 31 |
- testNet := network.CreateNoError(t, ctx, client, "testNet") |
|
| 32 |
- idPrefixNet := network.CreateNoError(t, ctx, client, testNet[:12]) |
|
| 33 |
- fullIDNet := network.CreateNoError(t, ctx, client, testNet) |
|
| 30 |
+func createAmbiguousNetworks(ctx context.Context, t *testing.T, client dclient.APIClient) (string, string, string) {
|
|
| 31 |
+ testNet := network.CreateNoError(ctx, t, client, "testNet") |
|
| 32 |
+ idPrefixNet := network.CreateNoError(ctx, t, client, testNet[:12]) |
|
| 33 |
+ fullIDNet := network.CreateNoError(ctx, t, client, testNet) |
|
| 34 | 34 |
|
| 35 | 35 |
nws, err := client.NetworkList(ctx, types.NetworkListOptions{})
|
| 36 | 36 |
assert.NilError(t, err) |
| ... | ... |
@@ -49,7 +49,7 @@ func TestNetworkCreateDelete(t *testing.T) {
|
| 49 | 49 |
ctx := context.Background() |
| 50 | 50 |
|
| 51 | 51 |
netName := "testnetwork_" + t.Name() |
| 52 |
- network.CreateNoError(t, ctx, client, netName, |
|
| 52 |
+ network.CreateNoError(ctx, t, client, netName, |
|
| 53 | 53 |
network.WithCheckDuplicate(), |
| 54 | 54 |
) |
| 55 | 55 |
assert.Check(t, IsNetworkAvailable(client, netName)) |
| ... | ... |
@@ -70,7 +70,7 @@ func TestDockerNetworkDeletePreferID(t *testing.T) {
|
| 70 | 70 |
defer setupTest(t)() |
| 71 | 71 |
client := testEnv.APIClient() |
| 72 | 72 |
ctx := context.Background() |
| 73 |
- testNet, idPrefixNet, fullIDNet := createAmbiguousNetworks(t, ctx, client) |
|
| 73 |
+ testNet, idPrefixNet, fullIDNet := createAmbiguousNetworks(ctx, t, client) |
|
| 74 | 74 |
|
| 75 | 75 |
// Delete the network using a prefix of the first network's ID as name. |
| 76 | 76 |
// This should the network name with the id-prefix, not the original network. |
| ... | ... |
@@ -21,7 +21,7 @@ func TestInspectNetwork(t *testing.T) {
|
| 21 | 21 |
defer c.Close() |
| 22 | 22 |
|
| 23 | 23 |
networkName := "Overlay" + t.Name() |
| 24 |
- overlayID := network.CreateNoError(t, context.Background(), c, networkName, |
|
| 24 |
+ overlayID := network.CreateNoError(context.Background(), t, c, networkName, |
|
| 25 | 25 |
network.WithDriver("overlay"),
|
| 26 | 26 |
network.WithCheckDuplicate(), |
| 27 | 27 |
) |
| ... | ... |
@@ -39,7 +39,7 @@ func TestDockerNetworkIpvlanPersistance(t *testing.T) {
|
| 39 | 39 |
|
| 40 | 40 |
// create a network specifying the desired sub-interface name |
| 41 | 41 |
netName := "di-persist" |
| 42 |
- net.CreateNoError(t, context.Background(), c, netName, |
|
| 42 |
+ net.CreateNoError(context.Background(), t, c, netName, |
|
| 43 | 43 |
net.WithIPvlan("di-dummy0.70", ""),
|
| 44 | 44 |
) |
| 45 | 45 |
|
| ... | ... |
@@ -105,7 +105,7 @@ func testIpvlanSubinterface(client dclient.APIClient) func(*testing.T) {
|
| 105 | 105 |
defer n.DeleteInterface(t, master) |
| 106 | 106 |
|
| 107 | 107 |
netName := "di-subinterface" |
| 108 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 108 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 109 | 109 |
net.WithIPvlan("di-dummy0.60", ""),
|
| 110 | 110 |
) |
| 111 | 111 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| ... | ... |
@@ -130,7 +130,7 @@ func testIpvlanOverlapParent(client dclient.APIClient) func(*testing.T) {
|
| 130 | 130 |
n.CreateVlanInterface(t, master, parent, "30") |
| 131 | 131 |
|
| 132 | 132 |
netName := "di-subinterface" |
| 133 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 133 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 134 | 134 |
net.WithIPvlan(parent, ""), |
| 135 | 135 |
) |
| 136 | 136 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| ... | ... |
@@ -147,14 +147,14 @@ func testIpvlanL2NilParent(client dclient.APIClient) func(*testing.T) {
|
| 147 | 147 |
return func(t *testing.T) {
|
| 148 | 148 |
// ipvlan l2 mode - dummy parent interface is provisioned dynamically |
| 149 | 149 |
netName := "di-nil-parent" |
| 150 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 150 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 151 | 151 |
net.WithIPvlan("", ""),
|
| 152 | 152 |
) |
| 153 | 153 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| 154 | 154 |
|
| 155 | 155 |
ctx := context.Background() |
| 156 |
- id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName)) |
|
| 157 |
- id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName)) |
|
| 156 |
+ id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName)) |
|
| 157 |
+ id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName)) |
|
| 158 | 158 |
|
| 159 | 159 |
_, err := container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
|
| 160 | 160 |
assert.NilError(t, err) |
| ... | ... |
@@ -164,15 +164,15 @@ func testIpvlanL2NilParent(client dclient.APIClient) func(*testing.T) {
|
| 164 | 164 |
func testIpvlanL2InternalMode(client dclient.APIClient) func(*testing.T) {
|
| 165 | 165 |
return func(t *testing.T) {
|
| 166 | 166 |
netName := "di-internal" |
| 167 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 167 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 168 | 168 |
net.WithIPvlan("", ""),
|
| 169 | 169 |
net.WithInternal(), |
| 170 | 170 |
) |
| 171 | 171 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| 172 | 172 |
|
| 173 | 173 |
ctx := context.Background() |
| 174 |
- id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName)) |
|
| 175 |
- id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName)) |
|
| 174 |
+ id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName)) |
|
| 175 |
+ id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName)) |
|
| 176 | 176 |
|
| 177 | 177 |
timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second) |
| 178 | 178 |
defer cancel() |
| ... | ... |
@@ -189,7 +189,7 @@ func testIpvlanL2InternalMode(client dclient.APIClient) func(*testing.T) {
|
| 189 | 189 |
func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
|
| 190 | 190 |
return func(t *testing.T) {
|
| 191 | 191 |
netName := "di-nil-parent-l3" |
| 192 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 192 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 193 | 193 |
net.WithIPvlan("", "l3"),
|
| 194 | 194 |
net.WithIPAM("172.28.230.0/24", ""),
|
| 195 | 195 |
net.WithIPAM("172.28.220.0/24", ""),
|
| ... | ... |
@@ -197,11 +197,11 @@ func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
|
| 197 | 197 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| 198 | 198 |
|
| 199 | 199 |
ctx := context.Background() |
| 200 |
- id1 := container.Run(t, ctx, client, |
|
| 200 |
+ id1 := container.Run(ctx, t, client, |
|
| 201 | 201 |
container.WithNetworkMode(netName), |
| 202 | 202 |
container.WithIPv4(netName, "172.28.220.10"), |
| 203 | 203 |
) |
| 204 |
- id2 := container.Run(t, ctx, client, |
|
| 204 |
+ id2 := container.Run(ctx, t, client, |
|
| 205 | 205 |
container.WithNetworkMode(netName), |
| 206 | 206 |
container.WithIPv4(netName, "172.28.230.10"), |
| 207 | 207 |
) |
| ... | ... |
@@ -214,7 +214,7 @@ func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
|
| 214 | 214 |
func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
|
| 215 | 215 |
return func(t *testing.T) {
|
| 216 | 216 |
netName := "di-internal-l3" |
| 217 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 217 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 218 | 218 |
net.WithIPvlan("", "l3"),
|
| 219 | 219 |
net.WithInternal(), |
| 220 | 220 |
net.WithIPAM("172.28.230.0/24", ""),
|
| ... | ... |
@@ -223,11 +223,11 @@ func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
|
| 223 | 223 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| 224 | 224 |
|
| 225 | 225 |
ctx := context.Background() |
| 226 |
- id1 := container.Run(t, ctx, client, |
|
| 226 |
+ id1 := container.Run(ctx, t, client, |
|
| 227 | 227 |
container.WithNetworkMode(netName), |
| 228 | 228 |
container.WithIPv4(netName, "172.28.220.10"), |
| 229 | 229 |
) |
| 230 |
- id2 := container.Run(t, ctx, client, |
|
| 230 |
+ id2 := container.Run(ctx, t, client, |
|
| 231 | 231 |
container.WithNetworkMode(netName), |
| 232 | 232 |
container.WithIPv4(netName, "172.28.230.10"), |
| 233 | 233 |
) |
| ... | ... |
@@ -247,7 +247,7 @@ func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
|
| 247 | 247 |
func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
| 248 | 248 |
return func(t *testing.T) {
|
| 249 | 249 |
netName := "dualstackl2" |
| 250 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 250 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 251 | 251 |
net.WithIPvlan("", ""),
|
| 252 | 252 |
net.WithIPv6(), |
| 253 | 253 |
net.WithIPAM("172.28.200.0/24", ""),
|
| ... | ... |
@@ -259,12 +259,12 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
| 259 | 259 |
|
| 260 | 260 |
// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
| 261 | 261 |
ctx := context.Background() |
| 262 |
- id1 := container.Run(t, ctx, client, |
|
| 262 |
+ id1 := container.Run(ctx, t, client, |
|
| 263 | 263 |
container.WithNetworkMode(netName), |
| 264 | 264 |
container.WithIPv4(netName, "172.28.200.20"), |
| 265 | 265 |
container.WithIPv6(netName, "2001:db8:abc8::20"), |
| 266 | 266 |
) |
| 267 |
- id2 := container.Run(t, ctx, client, |
|
| 267 |
+ id2 := container.Run(ctx, t, client, |
|
| 268 | 268 |
container.WithNetworkMode(netName), |
| 269 | 269 |
container.WithIPv4(netName, "172.28.200.21"), |
| 270 | 270 |
container.WithIPv6(netName, "2001:db8:abc8::21"), |
| ... | ... |
@@ -280,12 +280,12 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
| 280 | 280 |
assert.NilError(t, err) |
| 281 | 281 |
|
| 282 | 282 |
// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
| 283 |
- id3 := container.Run(t, ctx, client, |
|
| 283 |
+ id3 := container.Run(ctx, t, client, |
|
| 284 | 284 |
container.WithNetworkMode(netName), |
| 285 | 285 |
container.WithIPv4(netName, "172.28.202.20"), |
| 286 | 286 |
container.WithIPv6(netName, "2001:db8:abc6::20"), |
| 287 | 287 |
) |
| 288 |
- id4 := container.Run(t, ctx, client, |
|
| 288 |
+ id4 := container.Run(ctx, t, client, |
|
| 289 | 289 |
container.WithNetworkMode(netName), |
| 290 | 290 |
container.WithIPv4(netName, "172.28.202.21"), |
| 291 | 291 |
container.WithIPv6(netName, "2001:db8:abc6::21"), |
| ... | ... |
@@ -314,7 +314,7 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
| 314 | 314 |
func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
| 315 | 315 |
return func(t *testing.T) {
|
| 316 | 316 |
netName := "dualstackl3" |
| 317 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 317 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 318 | 318 |
net.WithIPvlan("", "l3"),
|
| 319 | 319 |
net.WithIPv6(), |
| 320 | 320 |
net.WithIPAM("172.28.10.0/24", ""),
|
| ... | ... |
@@ -326,12 +326,12 @@ func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
| 326 | 326 |
|
| 327 | 327 |
// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
| 328 | 328 |
ctx := context.Background() |
| 329 |
- id1 := container.Run(t, ctx, client, |
|
| 329 |
+ id1 := container.Run(ctx, t, client, |
|
| 330 | 330 |
container.WithNetworkMode(netName), |
| 331 | 331 |
container.WithIPv4(netName, "172.28.10.20"), |
| 332 | 332 |
container.WithIPv6(netName, "2001:db8:abc9::20"), |
| 333 | 333 |
) |
| 334 |
- id2 := container.Run(t, ctx, client, |
|
| 334 |
+ id2 := container.Run(ctx, t, client, |
|
| 335 | 335 |
container.WithNetworkMode(netName), |
| 336 | 336 |
container.WithIPv4(netName, "172.28.10.21"), |
| 337 | 337 |
container.WithIPv6(netName, "2001:db8:abc9::21"), |
| ... | ... |
@@ -347,12 +347,12 @@ func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
| 347 | 347 |
assert.NilError(t, err) |
| 348 | 348 |
|
| 349 | 349 |
// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
| 350 |
- id3 := container.Run(t, ctx, client, |
|
| 350 |
+ id3 := container.Run(ctx, t, client, |
|
| 351 | 351 |
container.WithNetworkMode(netName), |
| 352 | 352 |
container.WithIPv4(netName, "172.28.12.20"), |
| 353 | 353 |
container.WithIPv6(netName, "2001:db8:abc7::20"), |
| 354 | 354 |
) |
| 355 |
- id4 := container.Run(t, ctx, client, |
|
| 355 |
+ id4 := container.Run(ctx, t, client, |
|
| 356 | 356 |
container.WithNetworkMode(netName), |
| 357 | 357 |
container.WithIPv4(netName, "172.28.12.21"), |
| 358 | 358 |
container.WithIPv6(netName, "2001:db8:abc7::21"), |
| ... | ... |
@@ -383,7 +383,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
|
| 383 | 383 |
// Verify ipvlan l2 mode sets the proper default gateway routes via netlink |
| 384 | 384 |
// for either an explicitly set route by the user or inferred via default IPAM |
| 385 | 385 |
netNameL2 := "dualstackl2" |
| 386 |
- net.CreateNoError(t, context.Background(), client, netNameL2, |
|
| 386 |
+ net.CreateNoError(context.Background(), t, client, netNameL2, |
|
| 387 | 387 |
net.WithIPvlan("", "l2"),
|
| 388 | 388 |
net.WithIPv6(), |
| 389 | 389 |
net.WithIPAM("172.28.140.0/24", "172.28.140.254"),
|
| ... | ... |
@@ -392,7 +392,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
|
| 392 | 392 |
assert.Check(t, n.IsNetworkAvailable(client, netNameL2)) |
| 393 | 393 |
|
| 394 | 394 |
ctx := context.Background() |
| 395 |
- id1 := container.Run(t, ctx, client, |
|
| 395 |
+ id1 := container.Run(ctx, t, client, |
|
| 396 | 396 |
container.WithNetworkMode(netNameL2), |
| 397 | 397 |
) |
| 398 | 398 |
// Validate ipvlan l2 mode defaults gateway sets the default IPAM next-hop inferred from the subnet |
| ... | ... |
@@ -406,7 +406,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
|
| 406 | 406 |
|
| 407 | 407 |
// Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops |
| 408 | 408 |
netNameL3 := "dualstackl3" |
| 409 |
- net.CreateNoError(t, context.Background(), client, netNameL3, |
|
| 409 |
+ net.CreateNoError(context.Background(), t, client, netNameL3, |
|
| 410 | 410 |
net.WithIPvlan("", "l3"),
|
| 411 | 411 |
net.WithIPv6(), |
| 412 | 412 |
net.WithIPAM("172.28.160.0/24", "172.28.160.254"),
|
| ... | ... |
@@ -414,7 +414,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
|
| 414 | 414 |
) |
| 415 | 415 |
assert.Check(t, n.IsNetworkAvailable(client, netNameL3)) |
| 416 | 416 |
|
| 417 |
- id2 := container.Run(t, ctx, client, |
|
| 417 |
+ id2 := container.Run(ctx, t, client, |
|
| 418 | 418 |
container.WithNetworkMode(netNameL3), |
| 419 | 419 |
) |
| 420 | 420 |
// Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops |
| ... | ... |
@@ -33,7 +33,7 @@ func TestDockerNetworkMacvlanPersistance(t *testing.T) {
|
| 33 | 33 |
c := d.NewClientT(t) |
| 34 | 34 |
|
| 35 | 35 |
netName := "dm-persist" |
| 36 |
- net.CreateNoError(t, context.Background(), c, netName, |
|
| 36 |
+ net.CreateNoError(context.Background(), t, c, netName, |
|
| 37 | 37 |
net.WithMacvlan("dm-dummy0.60"),
|
| 38 | 38 |
) |
| 39 | 39 |
assert.Check(t, n.IsNetworkAvailable(c, netName)) |
| ... | ... |
@@ -86,7 +86,7 @@ func testMacvlanOverlapParent(client client.APIClient) func(*testing.T) {
|
| 86 | 86 |
|
| 87 | 87 |
netName := "dm-subinterface" |
| 88 | 88 |
parentName := "dm-dummy0.40" |
| 89 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 89 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 90 | 90 |
net.WithMacvlan(parentName), |
| 91 | 91 |
) |
| 92 | 92 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| ... | ... |
@@ -116,7 +116,7 @@ func testMacvlanSubinterface(client client.APIClient) func(*testing.T) {
|
| 116 | 116 |
n.CreateVlanInterface(t, master, parentName, "20") |
| 117 | 117 |
|
| 118 | 118 |
netName := "dm-subinterface" |
| 119 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 119 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 120 | 120 |
net.WithMacvlan(parentName), |
| 121 | 121 |
) |
| 122 | 122 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| ... | ... |
@@ -135,14 +135,14 @@ func testMacvlanNilParent(client client.APIClient) func(*testing.T) {
|
| 135 | 135 |
return func(t *testing.T) {
|
| 136 | 136 |
// macvlan bridge mode - dummy parent interface is provisioned dynamically |
| 137 | 137 |
netName := "dm-nil-parent" |
| 138 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 138 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 139 | 139 |
net.WithMacvlan(""),
|
| 140 | 140 |
) |
| 141 | 141 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| 142 | 142 |
|
| 143 | 143 |
ctx := context.Background() |
| 144 |
- id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName)) |
|
| 145 |
- id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName)) |
|
| 144 |
+ id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName)) |
|
| 145 |
+ id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName)) |
|
| 146 | 146 |
|
| 147 | 147 |
_, err := container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
|
| 148 | 148 |
assert.Check(t, err == nil) |
| ... | ... |
@@ -153,15 +153,15 @@ func testMacvlanInternalMode(client client.APIClient) func(*testing.T) {
|
| 153 | 153 |
return func(t *testing.T) {
|
| 154 | 154 |
// macvlan bridge mode - dummy parent interface is provisioned dynamically |
| 155 | 155 |
netName := "dm-internal" |
| 156 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 156 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 157 | 157 |
net.WithMacvlan(""),
|
| 158 | 158 |
net.WithInternal(), |
| 159 | 159 |
) |
| 160 | 160 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| 161 | 161 |
|
| 162 | 162 |
ctx := context.Background() |
| 163 |
- id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName)) |
|
| 164 |
- id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName)) |
|
| 163 |
+ id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName)) |
|
| 164 |
+ id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName)) |
|
| 165 | 165 |
|
| 166 | 166 |
timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second) |
| 167 | 167 |
defer cancel() |
| ... | ... |
@@ -178,7 +178,7 @@ func testMacvlanInternalMode(client client.APIClient) func(*testing.T) {
|
| 178 | 178 |
func testMacvlanMultiSubnet(client client.APIClient) func(*testing.T) {
|
| 179 | 179 |
return func(t *testing.T) {
|
| 180 | 180 |
netName := "dualstackbridge" |
| 181 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 181 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 182 | 182 |
net.WithMacvlan(""),
|
| 183 | 183 |
net.WithIPv6(), |
| 184 | 184 |
net.WithIPAM("172.28.100.0/24", ""),
|
| ... | ... |
@@ -191,12 +191,12 @@ func testMacvlanMultiSubnet(client client.APIClient) func(*testing.T) {
|
| 191 | 191 |
|
| 192 | 192 |
// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
| 193 | 193 |
ctx := context.Background() |
| 194 |
- id1 := container.Run(t, ctx, client, |
|
| 194 |
+ id1 := container.Run(ctx, t, client, |
|
| 195 | 195 |
container.WithNetworkMode("dualstackbridge"),
|
| 196 | 196 |
container.WithIPv4("dualstackbridge", "172.28.100.20"),
|
| 197 | 197 |
container.WithIPv6("dualstackbridge", "2001:db8:abc2::20"),
|
| 198 | 198 |
) |
| 199 |
- id2 := container.Run(t, ctx, client, |
|
| 199 |
+ id2 := container.Run(ctx, t, client, |
|
| 200 | 200 |
container.WithNetworkMode("dualstackbridge"),
|
| 201 | 201 |
container.WithIPv4("dualstackbridge", "172.28.100.21"),
|
| 202 | 202 |
container.WithIPv6("dualstackbridge", "2001:db8:abc2::21"),
|
| ... | ... |
@@ -212,12 +212,12 @@ func testMacvlanMultiSubnet(client client.APIClient) func(*testing.T) {
|
| 212 | 212 |
assert.NilError(t, err) |
| 213 | 213 |
|
| 214 | 214 |
// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
| 215 |
- id3 := container.Run(t, ctx, client, |
|
| 215 |
+ id3 := container.Run(ctx, t, client, |
|
| 216 | 216 |
container.WithNetworkMode("dualstackbridge"),
|
| 217 | 217 |
container.WithIPv4("dualstackbridge", "172.28.102.20"),
|
| 218 | 218 |
container.WithIPv6("dualstackbridge", "2001:db8:abc4::20"),
|
| 219 | 219 |
) |
| 220 |
- id4 := container.Run(t, ctx, client, |
|
| 220 |
+ id4 := container.Run(ctx, t, client, |
|
| 221 | 221 |
container.WithNetworkMode("dualstackbridge"),
|
| 222 | 222 |
container.WithIPv4("dualstackbridge", "172.28.102.21"),
|
| 223 | 223 |
container.WithIPv6("dualstackbridge", "2001:db8:abc4::21"),
|
| ... | ... |
@@ -247,7 +247,7 @@ func testMacvlanAddressing(client client.APIClient) func(*testing.T) {
|
| 247 | 247 |
return func(t *testing.T) {
|
| 248 | 248 |
// Ensure the default gateways, next-hops and default dev devices are properly set |
| 249 | 249 |
netName := "dualstackbridge" |
| 250 |
- net.CreateNoError(t, context.Background(), client, netName, |
|
| 250 |
+ net.CreateNoError(context.Background(), t, client, netName, |
|
| 251 | 251 |
net.WithMacvlan(""),
|
| 252 | 252 |
net.WithIPv6(), |
| 253 | 253 |
net.WithOption("macvlan_mode", "bridge"),
|
| ... | ... |
@@ -257,7 +257,7 @@ func testMacvlanAddressing(client client.APIClient) func(*testing.T) {
|
| 257 | 257 |
assert.Check(t, n.IsNetworkAvailable(client, netName)) |
| 258 | 258 |
|
| 259 | 259 |
ctx := context.Background() |
| 260 |
- id1 := container.Run(t, ctx, client, |
|
| 260 |
+ id1 := container.Run(ctx, t, client, |
|
| 261 | 261 |
container.WithNetworkMode("dualstackbridge"),
|
| 262 | 262 |
) |
| 263 | 263 |
|
| ... | ... |
@@ -29,14 +29,14 @@ func TestRunContainerWithBridgeNone(t *testing.T) {
|
| 29 | 29 |
c := d.NewClientT(t) |
| 30 | 30 |
ctx := context.Background() |
| 31 | 31 |
|
| 32 |
- id1 := container.Run(t, ctx, c) |
|
| 32 |
+ id1 := container.Run(ctx, t, c) |
|
| 33 | 33 |
defer c.ContainerRemove(ctx, id1, types.ContainerRemoveOptions{Force: true})
|
| 34 | 34 |
|
| 35 | 35 |
result, err := container.Exec(ctx, c, id1, []string{"ip", "l"})
|
| 36 | 36 |
assert.NilError(t, err) |
| 37 | 37 |
assert.Check(t, is.Equal(false, strings.Contains(result.Combined(), "eth0")), "There shouldn't be eth0 in container in default(bridge) mode when bridge network is disabled") |
| 38 | 38 |
|
| 39 |
- id2 := container.Run(t, ctx, c, container.WithNetworkMode("bridge"))
|
|
| 39 |
+ id2 := container.Run(ctx, t, c, container.WithNetworkMode("bridge"))
|
|
| 40 | 40 |
defer c.ContainerRemove(ctx, id2, types.ContainerRemoveOptions{Force: true})
|
| 41 | 41 |
|
| 42 | 42 |
result, err = container.Exec(ctx, c, id2, []string{"ip", "l"})
|
| ... | ... |
@@ -50,7 +50,7 @@ func TestRunContainerWithBridgeNone(t *testing.T) {
|
| 50 | 50 |
err = cmd.Run() |
| 51 | 51 |
assert.NilError(t, err, "Failed to get current process network namespace: %+v", err) |
| 52 | 52 |
|
| 53 |
- id3 := container.Run(t, ctx, c, container.WithNetworkMode("host"))
|
|
| 53 |
+ id3 := container.Run(ctx, t, c, container.WithNetworkMode("host"))
|
|
| 54 | 54 |
defer c.ContainerRemove(ctx, id3, types.ContainerRemoveOptions{Force: true})
|
| 55 | 55 |
|
| 56 | 56 |
result, err = container.Exec(ctx, c, id3, []string{"sh", "-c", nsCommand})
|
| ... | ... |
@@ -71,7 +71,7 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
|
| 71 | 71 |
|
| 72 | 72 |
// Create a bridge network and verify its subnet is the second default pool |
| 73 | 73 |
name := "elango" + t.Name() |
| 74 |
- network.CreateNoError(t, context.Background(), c, name, |
|
| 74 |
+ network.CreateNoError(context.Background(), t, c, name, |
|
| 75 | 75 |
network.WithDriver("bridge"),
|
| 76 | 76 |
) |
| 77 | 77 |
out, err = c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
|
| ... | ... |
@@ -80,7 +80,7 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
|
| 80 | 80 |
|
| 81 | 81 |
// Create a bridge network and verify its subnet is the third default pool |
| 82 | 82 |
name = "saanvi" + t.Name() |
| 83 |
- network.CreateNoError(t, context.Background(), c, name, |
|
| 83 |
+ network.CreateNoError(context.Background(), t, c, name, |
|
| 84 | 84 |
network.WithDriver("bridge"),
|
| 85 | 85 |
) |
| 86 | 86 |
out, err = c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
|
| ... | ... |
@@ -103,7 +103,7 @@ func TestDaemonRestartWithExistingNetwork(t *testing.T) {
|
| 103 | 103 |
|
| 104 | 104 |
// Create a bridge network |
| 105 | 105 |
name := "elango" + t.Name() |
| 106 |
- network.CreateNoError(t, context.Background(), c, name, |
|
| 106 |
+ network.CreateNoError(context.Background(), t, c, name, |
|
| 107 | 107 |
network.WithDriver("bridge"),
|
| 108 | 108 |
) |
| 109 | 109 |
|
| ... | ... |
@@ -136,7 +136,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
| 136 | 136 |
|
| 137 | 137 |
// Create a bridge network |
| 138 | 138 |
name := "elango" + t.Name() |
| 139 |
- network.CreateNoError(t, context.Background(), c, name, |
|
| 139 |
+ network.CreateNoError(context.Background(), t, c, name, |
|
| 140 | 140 |
network.WithDriver("bridge"),
|
| 141 | 141 |
) |
| 142 | 142 |
|
| ... | ... |
@@ -147,7 +147,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
| 147 | 147 |
|
| 148 | 148 |
// Create a bridge network |
| 149 | 149 |
name = "sthira" + t.Name() |
| 150 |
- network.CreateNoError(t, context.Background(), c, name, |
|
| 150 |
+ network.CreateNoError(context.Background(), t, c, name, |
|
| 151 | 151 |
network.WithDriver("bridge"),
|
| 152 | 152 |
) |
| 153 | 153 |
out, err = c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
|
| ... | ... |
@@ -162,7 +162,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
| 162 | 162 |
|
| 163 | 163 |
// Create a bridge network |
| 164 | 164 |
name = "saanvi" + t.Name() |
| 165 |
- network.CreateNoError(t, context.Background(), c, name, |
|
| 165 |
+ network.CreateNoError(context.Background(), t, c, name, |
|
| 166 | 166 |
network.WithDriver("bridge"),
|
| 167 | 167 |
) |
| 168 | 168 |
out1, err := c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
|
| ... | ... |
@@ -343,7 +343,7 @@ func TestServiceWithDataPathPortInit(t *testing.T) {
|
| 343 | 343 |
|
| 344 | 344 |
// Create a overlay network |
| 345 | 345 |
name := "saanvisthira" + t.Name() |
| 346 |
- network.CreateNoError(t, context.Background(), c, name, |
|
| 346 |
+ network.CreateNoError(context.Background(), t, c, name, |
|
| 347 | 347 |
network.WithDriver("overlay"))
|
| 348 | 348 |
|
| 349 | 349 |
var instances uint64 = 1 |
| ... | ... |
@@ -369,7 +369,7 @@ func TestServiceWithDataPathPortInit(t *testing.T) {
|
| 369 | 369 |
|
| 370 | 370 |
// Create a overlay network |
| 371 | 371 |
name = "saanvisthira" + t.Name() |
| 372 |
- network.CreateNoError(t, context.Background(), c, name, |
|
| 372 |
+ network.CreateNoError(context.Background(), t, c, name, |
|
| 373 | 373 |
network.WithDriver("overlay"))
|
| 374 | 374 |
|
| 375 | 375 |
serviceID = swarm.CreateService(t, d, |
| ... | ... |
@@ -402,7 +402,7 @@ func TestServiceWithDefaultAddressPoolInit(t *testing.T) {
|
| 402 | 402 |
|
| 403 | 403 |
// Create a overlay network |
| 404 | 404 |
name := "saanvisthira" + t.Name() |
| 405 |
- network.CreateNoError(t, context.Background(), cli, name, |
|
| 405 |
+ network.CreateNoError(context.Background(), t, cli, name, |
|
| 406 | 406 |
network.WithDriver("overlay"))
|
| 407 | 407 |
|
| 408 | 408 |
var instances uint64 = 1 |
| ... | ... |
@@ -92,7 +92,7 @@ func TestAuthZPluginAllowRequest(t *testing.T) {
|
| 92 | 92 |
ctx := context.Background() |
| 93 | 93 |
|
| 94 | 94 |
// Ensure command successful |
| 95 |
- cID := container.Run(t, ctx, c) |
|
| 95 |
+ cID := container.Run(ctx, t, c) |
|
| 96 | 96 |
|
| 97 | 97 |
assertURIRecorded(t, ctrl.requestsURIs, "/containers/create") |
| 98 | 98 |
assertURIRecorded(t, ctrl.requestsURIs, fmt.Sprintf("/containers/%s/start", cID))
|
| ... | ... |
@@ -224,7 +224,7 @@ func TestAuthZPluginAllowEventStream(t *testing.T) {
|
| 224 | 224 |
defer cancel() |
| 225 | 225 |
|
| 226 | 226 |
// Create a container and wait for the creation events |
| 227 |
- cID := container.Run(t, ctx, c) |
|
| 227 |
+ cID := container.Run(ctx, t, c) |
|
| 228 | 228 |
poll.WaitOn(t, container.IsInState(ctx, c, cID, "running")) |
| 229 | 229 |
|
| 230 | 230 |
created := false |
| ... | ... |
@@ -348,7 +348,7 @@ func TestAuthZPluginEnsureLoadImportWorking(t *testing.T) {
|
| 348 | 348 |
|
| 349 | 349 |
exportedImagePath := filepath.Join(tmp, "export.tar") |
| 350 | 350 |
|
| 351 |
- cID := container.Run(t, ctx, c) |
|
| 351 |
+ cID := container.Run(ctx, t, c) |
|
| 352 | 352 |
|
| 353 | 353 |
responseReader, err := c.ContainerExport(context.Background(), cID) |
| 354 | 354 |
assert.NilError(t, err) |
| ... | ... |
@@ -388,7 +388,7 @@ func TestAuthzPluginEnsureContainerCopyToFrom(t *testing.T) {
|
| 388 | 388 |
c := d.NewClientT(t) |
| 389 | 389 |
ctx := context.Background() |
| 390 | 390 |
|
| 391 |
- cID := container.Run(t, ctx, c) |
|
| 391 |
+ cID := container.Run(ctx, t, c) |
|
| 392 | 392 |
defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
|
| 393 | 393 |
|
| 394 | 394 |
_, err = f.Seek(0, io.SeekStart) |
| ... | ... |
@@ -55,7 +55,7 @@ func TestAuthZPluginV2AllowNonVolumeRequest(t *testing.T) {
|
| 55 | 55 |
d.LoadBusybox(t) |
| 56 | 56 |
|
| 57 | 57 |
// Ensure docker run command and accompanying docker ps are successful |
| 58 |
- cID := container.Run(t, ctx, c) |
|
| 58 |
+ cID := container.Run(ctx, t, c) |
|
| 59 | 59 |
|
| 60 | 60 |
_, err = c.ContainerInspect(ctx, cID) |
| 61 | 61 |
assert.NilError(t, err) |
| ... | ... |
@@ -360,7 +360,7 @@ func testExternalGraphDriver(ext string, ec map[string]*graphEventsCounter) func |
| 360 | 360 |
|
| 361 | 361 |
ctx := context.Background() |
| 362 | 362 |
|
| 363 |
- testGraphDriver(t, c, ctx, driverName, func(t *testing.T) {
|
|
| 363 |
+ testGraphDriver(ctx, t, c, driverName, func(t *testing.T) {
|
|
| 364 | 364 |
d.Restart(t, "-s", driverName) |
| 365 | 365 |
}) |
| 366 | 366 |
|
| ... | ... |
@@ -399,7 +399,7 @@ func testGraphDriverPull(c client.APIClient, d *daemon.Daemon) func(*testing.T) |
| 399 | 399 |
_, err = io.Copy(ioutil.Discard, r) |
| 400 | 400 |
assert.NilError(t, err) |
| 401 | 401 |
|
| 402 |
- container.Run(t, ctx, c, container.WithImage("busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0"))
|
|
| 402 |
+ container.Run(ctx, t, c, container.WithImage("busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0"))
|
|
| 403 | 403 |
} |
| 404 | 404 |
} |
| 405 | 405 |
|
| ... | ... |
@@ -434,12 +434,11 @@ func TestGraphdriverPluginV2(t *testing.T) {
|
| 434 | 434 |
d.Stop(t) |
| 435 | 435 |
d.StartWithBusybox(t, "-s", plugin, "--storage-opt", "overlay2.override_kernel_check=1") |
| 436 | 436 |
|
| 437 |
- testGraphDriver(t, client, ctx, plugin, nil) |
|
| 437 |
+ testGraphDriver(ctx, t, client, plugin, nil) |
|
| 438 | 438 |
} |
| 439 | 439 |
|
| 440 |
-// nolint: golint |
|
| 441 |
-func testGraphDriver(t *testing.T, c client.APIClient, ctx context.Context, driverName string, afterContainerRunFn func(*testing.T)) { //nolint: golint
|
|
| 442 |
- id := container.Run(t, ctx, c, container.WithCmd("sh", "-c", "echo hello > /hello"))
|
|
| 440 |
+func testGraphDriver(ctx context.Context, t *testing.T, c client.APIClient, driverName string, afterContainerRunFn func(*testing.T)) {
|
|
| 441 |
+ id := container.Run(ctx, t, c, container.WithCmd("sh", "-c", "echo hello > /hello"))
|
|
| 443 | 442 |
|
| 444 | 443 |
if afterContainerRunFn != nil {
|
| 445 | 444 |
afterContainerRunFn(t) |
| ... | ... |
@@ -33,7 +33,7 @@ func TestContinueAfterPluginCrash(t *testing.T) {
|
| 33 | 33 |
|
| 34 | 34 |
ctx, cancel = context.WithTimeout(context.Background(), 60*time.Second) |
| 35 | 35 |
|
| 36 |
- id := container.Run(t, ctx, client, |
|
| 36 |
+ id := container.Run(ctx, t, client, |
|
| 37 | 37 |
container.WithAutoRemove, |
| 38 | 38 |
container.WithLogDriver("test"),
|
| 39 | 39 |
container.WithCmd( |
| ... | ... |
@@ -84,7 +84,7 @@ func TestCreateServiceMultipleTimes(t *testing.T) {
|
| 84 | 84 |
ctx := context.Background() |
| 85 | 85 |
|
| 86 | 86 |
overlayName := "overlay1_" + t.Name() |
| 87 |
- overlayID := network.CreateNoError(t, ctx, client, overlayName, |
|
| 87 |
+ overlayID := network.CreateNoError(ctx, t, client, overlayName, |
|
| 88 | 88 |
network.WithCheckDuplicate(), |
| 89 | 89 |
network.WithDriver("overlay"),
|
| 90 | 90 |
) |
| ... | ... |
@@ -175,11 +175,11 @@ func TestCreateWithDuplicateNetworkNames(t *testing.T) {
|
| 175 | 175 |
ctx := context.Background() |
| 176 | 176 |
|
| 177 | 177 |
name := "foo_" + t.Name() |
| 178 |
- n1 := network.CreateNoError(t, ctx, client, name, network.WithDriver("bridge"))
|
|
| 179 |
- n2 := network.CreateNoError(t, ctx, client, name, network.WithDriver("bridge"))
|
|
| 178 |
+ n1 := network.CreateNoError(ctx, t, client, name, network.WithDriver("bridge"))
|
|
| 179 |
+ n2 := network.CreateNoError(ctx, t, client, name, network.WithDriver("bridge"))
|
|
| 180 | 180 |
|
| 181 | 181 |
// Duplicates with name but with different driver |
| 182 |
- n3 := network.CreateNoError(t, ctx, client, name, network.WithDriver("overlay"))
|
|
| 182 |
+ n3 := network.CreateNoError(ctx, t, client, name, network.WithDriver("overlay"))
|
|
| 183 | 183 |
|
| 184 | 184 |
// Create Service with the same name |
| 185 | 185 |
var instances uint64 = 1 |
| ... | ... |
@@ -24,12 +24,12 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
|
| 24 | 24 |
ctx := context.Background() |
| 25 | 25 |
|
| 26 | 26 |
name := t.Name() + "test-alias" |
| 27 |
- net.CreateNoError(t, ctx, client, name, |
|
| 27 |
+ net.CreateNoError(ctx, t, client, name, |
|
| 28 | 28 |
net.WithDriver("overlay"),
|
| 29 | 29 |
net.WithAttachable(), |
| 30 | 30 |
) |
| 31 | 31 |
|
| 32 |
- cID1 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) {
|
|
| 32 |
+ cID1 := container.Create(ctx, t, client, func(c *container.TestContainerConfig) {
|
|
| 33 | 33 |
c.NetworkingConfig = &network.NetworkingConfig{
|
| 34 | 34 |
EndpointsConfig: map[string]*network.EndpointSettings{
|
| 35 | 35 |
name: {},
|
| ... | ... |
@@ -52,7 +52,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
|
| 52 | 52 |
assert.Check(t, is.Equal(len(ng1.NetworkSettings.Networks[name].Aliases), 2)) |
| 53 | 53 |
assert.Check(t, is.Equal(ng1.NetworkSettings.Networks[name].Aliases[0], "aaa")) |
| 54 | 54 |
|
| 55 |
- cID2 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) {
|
|
| 55 |
+ cID2 := container.Create(ctx, t, client, func(c *container.TestContainerConfig) {
|
|
| 56 | 56 |
c.NetworkingConfig = &network.NetworkingConfig{
|
| 57 | 57 |
EndpointsConfig: map[string]*network.EndpointSettings{
|
| 58 | 58 |
name: {},
|
| ... | ... |
@@ -86,12 +86,12 @@ func TestDockerNetworkReConnect(t *testing.T) {
|
| 86 | 86 |
ctx := context.Background() |
| 87 | 87 |
|
| 88 | 88 |
name := t.Name() + "dummyNet" |
| 89 |
- net.CreateNoError(t, ctx, client, name, |
|
| 89 |
+ net.CreateNoError(ctx, t, client, name, |
|
| 90 | 90 |
net.WithDriver("overlay"),
|
| 91 | 91 |
net.WithAttachable(), |
| 92 | 92 |
) |
| 93 | 93 |
|
| 94 |
- c1 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) {
|
|
| 94 |
+ c1 := container.Create(ctx, t, client, func(c *container.TestContainerConfig) {
|
|
| 95 | 95 |
c.NetworkingConfig = &network.NetworkingConfig{
|
| 96 | 96 |
EndpointsConfig: map[string]*network.EndpointSettings{
|
| 97 | 97 |
name: {},
|
| ... | ... |
@@ -207,7 +207,7 @@ func TestServiceUpdateNetwork(t *testing.T) {
|
| 207 | 207 |
|
| 208 | 208 |
// Create a overlay network |
| 209 | 209 |
testNet := "testNet" + t.Name() |
| 210 |
- overlayID := network.CreateNoError(t, ctx, cli, testNet, |
|
| 210 |
+ overlayID := network.CreateNoError(ctx, t, cli, testNet, |
|
| 211 | 211 |
network.WithDriver("overlay"))
|
| 212 | 212 |
|
| 213 | 213 |
var instances uint64 = 1 |
| ... | ... |
@@ -41,7 +41,7 @@ func TestCgroupDriverSystemdMemoryLimit(t *testing.T) {
|
| 41 | 41 |
const mem = 64 * 1024 * 1024 // 64 MB |
| 42 | 42 |
|
| 43 | 43 |
ctx := context.Background() |
| 44 |
- ctrID := container.Create(t, ctx, c, func(ctr *container.TestContainerConfig) {
|
|
| 44 |
+ ctrID := container.Create(ctx, t, c, func(ctr *container.TestContainerConfig) {
|
|
| 45 | 45 |
ctr.HostConfig.Resources.Memory = mem |
| 46 | 46 |
}) |
| 47 | 47 |
defer c.ContainerRemove(ctx, ctrID, types.ContainerRemoveOptions{Force: true})
|
| ... | ... |
@@ -30,7 +30,7 @@ func TestEventsExecDie(t *testing.T) {
|
| 30 | 30 |
ctx := context.Background() |
| 31 | 31 |
client := testEnv.APIClient() |
| 32 | 32 |
|
| 33 |
- cID := container.Run(t, ctx, client) |
|
| 33 |
+ cID := container.Run(ctx, t, client) |
|
| 34 | 34 |
|
| 35 | 35 |
id, err := client.ContainerExecCreate(ctx, cID, |
| 36 | 36 |
types.ExecConfig{
|
| ... | ... |
@@ -83,7 +83,7 @@ func TestEventsBackwardsCompatible(t *testing.T) {
|
| 83 | 83 |
since := request.DaemonTime(ctx, t, client, testEnv) |
| 84 | 84 |
ts := strconv.FormatInt(since.Unix(), 10) |
| 85 | 85 |
|
| 86 |
- cID := container.Create(t, ctx, client) |
|
| 86 |
+ cID := container.Create(ctx, t, client) |
|
| 87 | 87 |
|
| 88 | 88 |
// In case there is no events, the API should have responded immediately (not blocking), |
| 89 | 89 |
// The test here makes sure the response time is less than 3 sec. |
| ... | ... |
@@ -68,7 +68,7 @@ func TestVolumesRemove(t *testing.T) {
|
| 68 | 68 |
|
| 69 | 69 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
| 70 | 70 |
|
| 71 |
- id := container.Create(t, ctx, client, container.WithVolume(prefix+slash+"foo")) |
|
| 71 |
+ id := container.Create(ctx, t, client, container.WithVolume(prefix+slash+"foo")) |
|
| 72 | 72 |
|
| 73 | 73 |
c, err := client.ContainerInspect(ctx, id) |
| 74 | 74 |
assert.NilError(t, err) |