Skip to content

Commit 2b7e084

Browse files
authored
Merge pull request moby#38473 from thaJeztah/use_testenv_client
Integration: use testenv.APIClient()
2 parents e78a3dc + 0de62d9 commit 2b7e084

36 files changed

+91
-118
lines changed

integration/build/build_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/docker/docker/api/types/filters"
1616
"github.com/docker/docker/api/types/versions"
1717
"github.com/docker/docker/internal/test/fakecontext"
18-
"github.com/docker/docker/internal/test/request"
1918
"github.com/docker/docker/pkg/jsonmessage"
2019
"gotest.tools/assert"
2120
is "gotest.tools/assert/cmp"
@@ -25,7 +24,7 @@ import (
2524
func TestBuildWithRemoveAndForceRemove(t *testing.T) {
2625
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
2726
defer setupTest(t)()
28-
t.Parallel()
27+
2928
cases := []struct {
3029
name string
3130
dockerfile string
@@ -89,7 +88,7 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
8988
},
9089
}
9190

92-
client := request.NewAPIClient(t)
91+
client := testEnv.APIClient()
9392
ctx := context.Background()
9493
for _, c := range cases {
9594
t.Run(c.name, func(t *testing.T) {

integration/container/create_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
2626
defer setupTest(t)()
27-
client := request.NewAPIClient(t)
27+
client := testEnv.APIClient()
2828

2929
testCases := []struct {
3030
doc string
@@ -65,7 +65,7 @@ func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
6565

6666
func TestCreateWithInvalidEnv(t *testing.T) {
6767
defer setupTest(t)()
68-
client := request.NewAPIClient(t)
68+
client := testEnv.APIClient()
6969

7070
testCases := []struct {
7171
env string
@@ -108,7 +108,7 @@ func TestCreateTmpfsMountsTarget(t *testing.T) {
108108
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
109109

110110
defer setupTest(t)()
111-
client := request.NewAPIClient(t)
111+
client := testEnv.APIClient()
112112

113113
testCases := []struct {
114114
target string
@@ -150,7 +150,7 @@ func TestCreateWithCustomMaskedPaths(t *testing.T) {
150150
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
151151

152152
defer setupTest(t)()
153-
client := request.NewAPIClient(t)
153+
client := testEnv.APIClient()
154154
ctx := context.Background()
155155

156156
testCases := []struct {
@@ -229,7 +229,7 @@ func TestCreateWithCustomReadonlyPaths(t *testing.T) {
229229
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
230230

231231
defer setupTest(t)()
232-
client := request.NewAPIClient(t)
232+
client := testEnv.APIClient()
233233
ctx := context.Background()
234234

235235
testCases := []struct {

integration/container/diff_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77

88
containertypes "github.com/docker/docker/api/types/container"
99
"github.com/docker/docker/integration/internal/container"
10-
"github.com/docker/docker/internal/test/request"
1110
"github.com/docker/docker/pkg/archive"
1211
"gotest.tools/assert"
1312
"gotest.tools/poll"
@@ -17,7 +16,7 @@ import (
1716
func TestDiff(t *testing.T) {
1817
skip.If(t, testEnv.OSType == "windows", "FIXME")
1918
defer setupTest(t)()
20-
client := request.NewAPIClient(t)
19+
client := testEnv.APIClient()
2120
ctx := context.Background()
2221

2322
cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))

integration/container/exec_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/docker/docker/api/types/strslice"
1111
"github.com/docker/docker/api/types/versions"
1212
"github.com/docker/docker/integration/internal/container"
13-
"github.com/docker/docker/internal/test/request"
1413
"gotest.tools/assert"
1514
is "gotest.tools/assert/cmp"
1615
"gotest.tools/skip"
@@ -22,7 +21,7 @@ func TestExecWithCloseStdin(t *testing.T) {
2221
defer setupTest(t)()
2322

2423
ctx := context.Background()
25-
client := request.NewAPIClient(t)
24+
client := testEnv.APIClient()
2625

2726
// run top with detached mode
2827
cID := container.Run(t, ctx, client)
@@ -89,7 +88,7 @@ func TestExec(t *testing.T) {
8988
skip.If(t, testEnv.OSType == "windows", "FIXME. Probably needs to wait for container to be in running state.")
9089
defer setupTest(t)()
9190
ctx := context.Background()
92-
client := request.NewAPIClient(t)
91+
client := testEnv.APIClient()
9392

9493
cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/root"))
9594

integration/container/export_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/docker/docker/api/types/filters"
1111
"github.com/docker/docker/integration/internal/container"
1212
"github.com/docker/docker/internal/test/daemon"
13-
"github.com/docker/docker/internal/test/request"
1413
"github.com/docker/docker/pkg/jsonmessage"
1514
"gotest.tools/assert"
1615
is "gotest.tools/assert/cmp"
@@ -23,7 +22,7 @@ func TestExportContainerAndImportImage(t *testing.T) {
2322
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
2423

2524
defer setupTest(t)()
26-
client := request.NewAPIClient(t)
25+
client := testEnv.APIClient()
2726
ctx := context.Background()
2827

2928
cID := container.Run(t, ctx, client, container.WithCmd("true"))

integration/container/health_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
containertypes "github.com/docker/docker/api/types/container"
1010
"github.com/docker/docker/client"
1111
"github.com/docker/docker/integration/internal/container"
12-
"github.com/docker/docker/internal/test/request"
1312
"gotest.tools/poll"
1413
"gotest.tools/skip"
1514
)
@@ -20,7 +19,7 @@ func TestHealthCheckWorkdir(t *testing.T) {
2019
skip.If(t, testEnv.OSType == "windows", "FIXME")
2120
defer setupTest(t)()
2221
ctx := context.Background()
23-
client := request.NewAPIClient(t)
22+
client := testEnv.APIClient()
2423

2524
cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
2625
c.Config.Healthcheck = &containertypes.HealthConfig{

integration/container/ipcmode_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
containertypes "github.com/docker/docker/api/types/container"
1414
"github.com/docker/docker/integration/internal/container"
1515
"github.com/docker/docker/internal/test/daemon"
16-
"github.com/docker/docker/internal/test/request"
1716
"gotest.tools/assert"
1817
is "gotest.tools/assert/cmp"
1918
"gotest.tools/fs"
@@ -61,7 +60,7 @@ func testIpcNonePrivateShareable(t *testing.T, mode string, mustBeMounted bool,
6160
hostCfg := containertypes.HostConfig{
6261
IpcMode: containertypes.IpcMode(mode),
6362
}
64-
client := request.NewAPIClient(t)
63+
client := testEnv.APIClient()
6564
ctx := context.Background()
6665

6766
resp, err := client.ContainerCreate(ctx, &cfg, &hostCfg, nil, "")
@@ -132,7 +131,7 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) {
132131
IpcMode: containertypes.IpcMode(donorMode),
133132
}
134133
ctx := context.Background()
135-
client := request.NewAPIClient(t)
134+
client := testEnv.APIClient()
136135

137136
// create and start the "donor" container
138137
resp, err := client.ContainerCreate(ctx, &cfg, &hostCfg, nil, "")

integration/container/kill_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
func TestKillContainerInvalidSignal(t *testing.T) {
1919
defer setupTest(t)()
20-
client := request.NewAPIClient(t)
20+
client := testEnv.APIClient()
2121
ctx := context.Background()
2222
id := container.Run(t, ctx, client)
2323

@@ -33,7 +33,7 @@ func TestKillContainerInvalidSignal(t *testing.T) {
3333
func TestKillContainer(t *testing.T) {
3434
skip.If(t, testEnv.OSType == "windows", "TODO Windows: FIXME. No SIGWINCH")
3535
defer setupTest(t)()
36-
client := request.NewAPIClient(t)
36+
client := testEnv.APIClient()
3737

3838
testCases := []struct {
3939
doc string
@@ -73,7 +73,7 @@ func TestKillContainer(t *testing.T) {
7373
func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
7474
skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later")
7575
defer setupTest(t)()
76-
client := request.NewAPIClient(t)
76+
client := testEnv.APIClient()
7777

7878
testCases := []struct {
7979
doc string
@@ -114,7 +114,7 @@ func TestKillStoppedContainer(t *testing.T) {
114114
skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later")
115115
defer setupTest(t)()
116116
ctx := context.Background()
117-
client := request.NewAPIClient(t)
117+
client := testEnv.APIClient()
118118
id := container.Create(t, ctx, client)
119119
err := client.ContainerKill(ctx, id, "SIGKILL")
120120
assert.Assert(t, is.ErrorContains(err, ""))
@@ -154,7 +154,7 @@ func TestInspectOomKilledTrue(t *testing.T) {
154154

155155
defer setupTest(t)()
156156
ctx := context.Background()
157-
client := request.NewAPIClient(t)
157+
client := testEnv.APIClient()
158158

159159
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) {
160160
c.HostConfig.Resources.Memory = 32 * 1024 * 1024
@@ -172,7 +172,7 @@ func TestInspectOomKilledFalse(t *testing.T) {
172172

173173
defer setupTest(t)()
174174
ctx := context.Background()
175-
client := request.NewAPIClient(t)
175+
client := testEnv.APIClient()
176176

177177
cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "echo hello world"))
178178

integration/container/links_linux_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/docker/docker/api/types"
1010
"github.com/docker/docker/api/types/filters"
1111
"github.com/docker/docker/integration/internal/container"
12-
"github.com/docker/docker/internal/test/request"
1312
"gotest.tools/assert"
1413
is "gotest.tools/assert/cmp"
1514
"gotest.tools/skip"
@@ -22,7 +21,7 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
2221
skip.If(t, os.IsNotExist(err))
2322

2423
defer setupTest(t)()
25-
client := request.NewAPIClient(t)
24+
client := testEnv.APIClient()
2625
ctx := context.Background()
2726

2827
cID := container.Run(t, ctx, client, container.WithNetworkMode("host"))
@@ -38,7 +37,7 @@ func TestLinksContainerNames(t *testing.T) {
3837
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
3938

4039
defer setupTest(t)()
41-
client := request.NewAPIClient(t)
40+
client := testEnv.APIClient()
4241
ctx := context.Background()
4342

4443
containerA := "first_" + t.Name()

integration/container/logs_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77

88
"github.com/docker/docker/api/types"
99
"github.com/docker/docker/integration/internal/container"
10-
"github.com/docker/docker/internal/test/request"
1110
"github.com/docker/docker/pkg/stdcopy"
1211
"gotest.tools/assert"
1312
"gotest.tools/skip"
@@ -19,7 +18,7 @@ func TestLogsFollowTailEmpty(t *testing.T) {
1918
// FIXME(vdemeester) fails on a e2e run on linux...
2019
skip.If(t, testEnv.IsRemoteDaemon())
2120
defer setupTest(t)()
22-
client := request.NewAPIClient(t)
21+
client := testEnv.APIClient()
2322
ctx := context.Background()
2423

2524
id := container.Run(t, ctx, client, container.WithCmd("sleep", "100000"))

0 commit comments

Comments
 (0)