@@ -13,17 +13,20 @@ import (
1313
1414func TestPushInsecureRegistry (t * testing.T ) {
1515 runWithDindSwarmAndRegistry (t , func (info dindSwarmAndRegistryInfo ) {
16+ path := filepath .Join ("testdata" , "local" )
1617 ref := info .registryAddress + "/test/push-insecure"
1718
1819 // create a command outside of the dind context so without the insecure registry configured
1920 cmdNoInsecureRegistry , cleanupNoInsecureRegistryCommand := dockerCli .createTestCmd ()
2021 defer cleanupNoInsecureRegistryCommand ()
21- cmdNoInsecureRegistry .Command = dockerCli .Command ("app" , "push" , "--tag" , ref , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ))
22+ build (t , cmdNoInsecureRegistry , dockerCli , ref , path )
23+ cmdNoInsecureRegistry .Command = dockerCli .Command ("app" , "push" , ref )
2224 icmd .RunCmd (cmdNoInsecureRegistry ).Assert (t , icmd.Expected {ExitCode : 1 })
2325
24- // run the push with the command inside dind context configured to allow access to the insecure registry
26+ // run the push with the command inside dind context configured to allow access to the insecure registr
2527 cmd := info .configuredCmd
26- cmd .Command = dockerCli .Command ("app" , "push" , "--tag" , ref , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ))
28+ build (t , cmd , dockerCli , ref , path )
29+ cmd .Command = dockerCli .Command ("app" , "push" , ref )
2730 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
2831 })
2932}
@@ -32,16 +35,15 @@ func TestPushInstall(t *testing.T) {
3235 runWithDindSwarmAndRegistry (t , func (info dindSwarmAndRegistryInfo ) {
3336 cmd := info .configuredCmd
3437 ref := info .registryAddress + "/test/push-pull"
35- path := filepath .Join ("testdata" , "push-pull" )
36- cmd .Command = dockerCli .Command ("app" , "build" , "-f" , filepath .Join (path , "push-pull.dockerapp" ), "-t" , ref , path )
37- icmd .RunCmd (cmd ).Assert (t , icmd .Success )
38+ build (t , cmd , dockerCli , ref , filepath .Join ("testdata" , "push-pull" ))
39+
3840 cmd .Command = dockerCli .Command ("app" , "push" , ref )
3941 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
4042
4143 cmd .Command = dockerCli .Command ("app" , "run" , ref , "--name" , t .Name ())
4244 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
4345 cmd .Command = dockerCli .Command ("service" , "ls" )
44- assert .Check (t , cmp .Contains (icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (), ref ))
46+ assert .Check (t , cmp .Contains (icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (), t . Name () ))
4547 })
4648}
4749
@@ -50,9 +52,8 @@ func TestPushPullInstall(t *testing.T) {
5052 cmd := info .configuredCmd
5153 ref := info .registryAddress + "/test/push-pull"
5254 tag := ":v.0.0.1"
53- path := filepath .Join ("testdata" , "push-pull" )
54- cmd .Command = dockerCli .Command ("app" , "build" , "-f" , filepath .Join (path , "push-pull.dockerapp" ), "-t" , ref + tag , path )
55- icmd .RunCmd (cmd ).Assert (t , icmd .Success )
55+ build (t , cmd , dockerCli , ref + tag , filepath .Join ("testdata" , "push-pull" ))
56+
5657 cmd .Command = dockerCli .Command ("app" , "push" , ref + tag )
5758 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
5859 cmd .Command = dockerCli .Command ("app" , "pull" , ref + tag )
@@ -91,8 +92,7 @@ func TestPushInstallBundle(t *testing.T) {
9192 ref := info .registryAddress + "/test/push-bundle"
9293
9394 // render the app to a bundle, we use the app from the push pull test above.
94- cmd .Command = dockerCli .Command ("app" , "build" , "--tag" , "a-simple-app:1.0.0" , filepath .Join ("testdata" , "push-pull" ))
95- icmd .RunCmd (cmd ).Assert (t , icmd .Success )
95+ build (t , cmd , dockerCli , "a-simple-app:1.0.0" , filepath .Join ("testdata" , "push-pull" ))
9696
9797 // push it and install to check it is available
9898 t .Run ("push-bundle" , func (t * testing.T ) {
@@ -105,14 +105,14 @@ func TestPushInstallBundle(t *testing.T) {
105105 cmd .Command = dockerCli .Command ("app" , "run" , ref , "--name" , name )
106106 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
107107 cmd .Command = dockerCli .Command ("service" , "ls" )
108- assert .Check (t , cmp .Contains (icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (), ref ))
108+ assert .Check (t , cmp .Contains (icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (), name ))
109109
110110 // ensure it doesn't confuse the next test
111111 cmd .Command = dockerCli .Command ("app" , "rm" , name )
112112 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
113113
114114 cmd .Command = dockerCli .Command ("service" , "ls" )
115- assert .Check (t , ! strings .Contains (icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (), ref ))
115+ assert .Check (t , ! strings .Contains (icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (), name ))
116116 })
117117
118118 // push it again using the first ref and install from the new ref to check it is also available
@@ -127,7 +127,7 @@ func TestPushInstallBundle(t *testing.T) {
127127 cmd .Command = dockerCli .Command ("app" , "run" , ref2 , "--name" , name )
128128 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
129129 cmd .Command = dockerCli .Command ("service" , "ls" )
130- assert .Check (t , cmp .Contains (icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (), ref2 ))
130+ assert .Check (t , cmp .Contains (icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (), name ))
131131 })
132132
133133 // push it again using an app pre-bundled and tagged in the bundle store and install it to check it is also available
@@ -143,8 +143,7 @@ func TestPushInstallBundle(t *testing.T) {
143143 cmdIsolatedStore .Env = append (cmdIsolatedStore .Env , "DOCKER_CONTEXT=swarm-context" )
144144
145145 // bundle the app again but this time with a tag to store it into the bundle store
146- cmdIsolatedStore .Command = dockerCli .Command ("app" , "build" , "--tag" , ref2 , filepath .Join ("testdata" , "push-pull" ))
147- icmd .RunCmd (cmdIsolatedStore ).Assert (t , icmd .Success )
146+ build (t , cmdIsolatedStore , dockerCli , ref2 , filepath .Join ("testdata" , "push-pull" ))
148147 // Push the app without tagging it explicitly
149148 cmdIsolatedStore .Command = dockerCli .Command ("app" , "push" , ref2 )
150149 icmd .RunCmd (cmdIsolatedStore ).Assert (t , icmd .Success )
@@ -154,7 +153,7 @@ func TestPushInstallBundle(t *testing.T) {
154153 cmd .Command = dockerCli .Command ("app" , "run" , ref2 , "--name" , name )
155154 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
156155 cmd .Command = dockerCli .Command ("service" , "ls" )
157- assert .Check (t , cmp .Contains (icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (), ref ))
156+ assert .Check (t , cmp .Contains (icmd .RunCmd (cmd ).Assert (t , icmd .Success ).Combined (), name ))
158157 })
159158 })
160159}
0 commit comments