summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/client_test.go33
1 files changed, 18 insertions, 15 deletions
diff --git a/client/client_test.go b/client/client_test.go
index 10cf2d2f45..bb31ff069e 100644
--- a/client/client_test.go
+++ b/client/client_test.go
@@ -85,23 +85,26 @@ func TestNewClientWithOpsFromEnv(t *testing.T) {
},
}
- defer env.PatchAll(t, nil)()
+ env.PatchAll(t, nil)
for _, tc := range testcases {
- env.PatchAll(t, tc.envs)
- client, err := NewClientWithOpts(FromEnv)
- if tc.expectedError != "" {
- assert.Check(t, is.Error(err, tc.expectedError), tc.doc)
- } else {
- assert.Check(t, err, tc.doc)
- assert.Check(t, is.Equal(client.ClientVersion(), tc.expectedVersion), tc.doc)
- }
+ tc := tc
+ t.Run(tc.doc, func(t *testing.T) {
+ env.PatchAll(t, tc.envs)
+ client, err := NewClientWithOpts(FromEnv)
+ if tc.expectedError != "" {
+ assert.Check(t, is.Error(err, tc.expectedError))
+ } else {
+ assert.Check(t, err)
+ assert.Check(t, is.Equal(client.ClientVersion(), tc.expectedVersion))
+ }
- if tc.envs["DOCKER_TLS_VERIFY"] != "" {
- // pedantic checking that this is handled correctly
- tr := client.client.Transport.(*http.Transport)
- assert.Assert(t, tr.TLSClientConfig != nil, tc.doc)
- assert.Check(t, is.Equal(tr.TLSClientConfig.InsecureSkipVerify, false), tc.doc)
- }
+ if tc.envs["DOCKER_TLS_VERIFY"] != "" {
+ // pedantic checking that this is handled correctly
+ tr := client.client.Transport.(*http.Transport)
+ assert.Assert(t, tr.TLSClientConfig != nil)
+ assert.Check(t, is.Equal(tr.TLSClientConfig.InsecureSkipVerify, false))
+ }
+ })
}
}