@@ -126,10 +126,10 @@ func TestPushInsecureRegistry(t *testing.T) {
126126 ref := info .registryAddress + "/test/push-insecure"
127127
128128 // create a command outside of the dind context so without the insecure registry configured
129- cmd2 , cleanup2 := dockerCli .createTestCmd ()
130- defer cleanup2 ()
131- cmd2 .Command = dockerCli .Command ("app" , "push" , "--tag" , ref , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ))
132- icmd .RunCmd (cmd2 ).Assert (t , icmd.Expected {ExitCode : 1 })
129+ cmdNoInsecureRegistry , cleanupNoInsecureRegistryCommand := dockerCli .createTestCmd ()
130+ defer cleanupNoInsecureRegistryCommand ()
131+ cmdNoInsecureRegistry .Command = dockerCli .Command ("app" , "push" , "--tag" , ref , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ))
132+ icmd .RunCmd (cmdNoInsecureRegistry ).Assert (t , icmd.Expected {ExitCode : 1 })
133133
134134 // run the push with the command inside dind context configured to allow access to the insecure registry
135135 cmd := info .configuredCmd
@@ -234,21 +234,21 @@ func TestPushInstallBundle(t *testing.T) {
234234 name := strings .Replace (t .Name (), "/" , "_" , 1 )
235235 ref2 := ref + ":v0.42"
236236 // Create a new command so the bundle store can be trashed before installing the app
237- cmd2 , cleanup2 := dockerCli .createTestCmd ()
237+ cmdIsolatedStore , cleanupIsolatedStore := dockerCli .createTestCmd ()
238238
239239 // Enter the same context as `cmd` to run commands within the same environment
240- cmd2 .Command = dockerCli .Command ("context" , "create" , "swarm-context" , "--docker" , fmt .Sprintf (`"host=tcp://%s"` , info .swarmAddress ))
241- icmd .RunCmd (cmd2 ).Assert (t , icmd .Success )
242- cmd2 .Env = append (cmd2 .Env , "DOCKER_CONTEXT=swarm-context" )
240+ cmdIsolatedStore .Command = dockerCli .Command ("context" , "create" , "swarm-context" , "--docker" , fmt .Sprintf (`"host=tcp://%s"` , info .swarmAddress ))
241+ icmd .RunCmd (cmdIsolatedStore ).Assert (t , icmd .Success )
242+ cmdIsolatedStore .Env = append (cmdIsolatedStore .Env , "DOCKER_CONTEXT=swarm-context" )
243243
244244 // bundle the app again but this time with a tag to store it into the bundle store
245- cmd2 .Command = dockerCli .Command ("app" , "bundle" , "--tag" , ref2 , "-o" , bundleFile , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ))
246- icmd .RunCmd (cmd2 ).Assert (t , icmd .Success )
245+ cmdIsolatedStore .Command = dockerCli .Command ("app" , "bundle" , "--tag" , ref2 , "-o" , bundleFile , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ))
246+ icmd .RunCmd (cmdIsolatedStore ).Assert (t , icmd .Success )
247247 // Push the app without tagging it explicitly
248- cmd2 .Command = dockerCli .Command ("app" , "push" , ref2 )
249- icmd .RunCmd (cmd2 ).Assert (t , icmd .Success )
248+ cmdIsolatedStore .Command = dockerCli .Command ("app" , "push" , ref2 )
249+ icmd .RunCmd (cmdIsolatedStore ).Assert (t , icmd .Success )
250250 // remove the bundle from the bundle store to be sure it won't be used instead of registry
251- cleanup2 ()
251+ cleanupIsolatedStore ()
252252 // install from the registry
253253 cmd .Command = dockerCli .Command ("app" , "install" , ref2 , "--name" , name )
254254 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
0 commit comments