@@ -15,26 +15,14 @@ var (
1515 reg = regexp .MustCompile ("Digest is (.*)." )
1616)
1717
18- func insertBundles (t * testing.T , cmd icmd.Cmd , dir * fs.Dir , info dindSwarmAndRegistryInfo ) string {
18+ func insertBundles (t * testing.T , cmd icmd.Cmd , dir * fs.Dir , info dindSwarmAndRegistryInfo ) {
1919 // Push an application so that we can later pull it by digest
20- cmd .Command = dockerCli .Command ("app" , "push" , "--tag" , info .registryAddress + "/c-myapp" , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ))
21- r := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
22-
23- // Get the digest from the output of the pull command
24- out := r .Stdout ()
25- matches := reg .FindAllStringSubmatch (out , 1 )
26- digest := matches [0 ][1 ]
27-
28- // Pull the app by digest
29- cmd .Command = dockerCli .Command ("app" , "pull" , info .registryAddress + "/c-myapp@" + digest )
20+ cmd .Command = dockerCli .Command ("app" , "build" , "--tag" , info .registryAddress + "/c-myapp" , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ))
3021 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
31-
32- cmd .Command = dockerCli .Command ("app" , "bundle" , filepath .Join ("testdata" , "simple" , "simple.dockerapp" ), "--tag" , "b-simple-app" , "--output" , dir .Join ("simple-bundle.json" ))
22+ cmd .Command = dockerCli .Command ("app" , "build" , filepath .Join ("testdata" , "simple" , "simple.dockerapp" ), "--tag" , "b-simple-app" )
3323 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
34- cmd .Command = dockerCli .Command ("app" , "bundle " , filepath .Join ("testdata" , "simple" , "simple.dockerapp" ), "--tag" , "a-simple-app" , "--output" , dir . Join ( "simple-bundle.json" ) )
24+ cmd .Command = dockerCli .Command ("app" , "build " , filepath .Join ("testdata" , "simple" , "simple.dockerapp" ), "--tag" , "a-simple-app" )
3525 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
36-
37- return digest
3826}
3927
4028func expectImageListOutput (t * testing.T , cmd icmd.Cmd , output string ) {
@@ -49,14 +37,14 @@ func TestImageList(t *testing.T) {
4937 dir := fs .NewDir (t , "" )
5038 defer dir .Remove ()
5139
52- digest := insertBundles (t , cmd , dir , info )
40+ insertBundles (t , cmd , dir , info )
5341
5442 expected := `APP IMAGE APP NAME
5543%s push-pull
56- a-simple-app:latest simple
57- b-simple-app:latest simple
44+ a-simple-app:latest simple
45+ b-simple-app:latest simple
5846`
59- expectedOutput := fmt .Sprintf (expected , info .registryAddress + "/c-myapp@" + digest )
47+ expectedOutput := fmt .Sprintf (expected , info .registryAddress + "/c-myapp:latest" )
6048 expectImageListOutput (t , cmd , expectedOutput )
6149 })
6250}
@@ -67,12 +55,12 @@ func TestImageRm(t *testing.T) {
6755 dir := fs .NewDir (t , "" )
6856 defer dir .Remove ()
6957
70- digest := insertBundles (t , cmd , dir , info )
58+ insertBundles (t , cmd , dir , info )
7159
72- cmd .Command = dockerCli .Command ("app" , "image" , "rm" , info .registryAddress + "/c-myapp@" + digest )
60+ cmd .Command = dockerCli .Command ("app" , "image" , "rm" , info .registryAddress + "/c-myapp:latest" )
7361 icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
7462 ExitCode : 0 ,
75- Out : "Deleted: " + info .registryAddress + "/c-myapp@" + digest ,
63+ Out : "Deleted: " + info .registryAddress + "/c-myapp:latest" ,
7664 })
7765
7866 cmd .Command = dockerCli .Command ("app" , "image" , "rm" , "a-simple-app" , "b-simple-app:latest" )
@@ -96,16 +84,14 @@ Deleted: b-simple-app:latest`,
9684func TestImageTag (t * testing.T ) {
9785 runWithDindSwarmAndRegistry (t , func (info dindSwarmAndRegistryInfo ) {
9886 cmd := info .configuredCmd
99- dir := fs .NewDir (t , "" )
100- defer dir .Remove ()
10187
10288 dockerAppImageTag := func (args ... string ) {
10389 cmdArgs := append ([]string {"app" , "image" , "tag" }, args ... )
10490 cmd .Command = dockerCli .Command (cmdArgs ... )
10591 }
10692
10793 // given a first available image
108- cmd .Command = dockerCli .Command ("app" , "bundle " , filepath .Join ("testdata" , "simple" , "simple.dockerapp" ), "--tag" , "a-simple-app" , "--output" , dir . Join ( "simple-bundle.json" ) )
94+ cmd .Command = dockerCli .Command ("app" , "build " , filepath .Join ("testdata" , "simple" , "simple.dockerapp" ), "--tag" , "a-simple-app" )
10995 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
11096
11197 singleImageExpectation := `APP IMAGE APP NAME
@@ -119,20 +105,26 @@ a-simple-app:latest simple
119105 ExitCode : 1 ,
120106 Err : `"docker app image tag" requires exactly 2 arguments.` ,
121107 })
108+ cmd .Command = dockerCli .Command ("app" , "image" , "tag" )
109+ icmd .RunCmd (cmd ).Assert (t , icmd.Expected {ExitCode : 1 })
122110
123111 // with one argument
124112 dockerAppImageTag ("a-simple-app" )
125113 icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
126114 ExitCode : 1 ,
127115 Err : `"docker app image tag" requires exactly 2 arguments.` ,
128116 })
117+ cmd .Command = dockerCli .Command ("app" , "image" , "tag" , "a-simple-app" )
118+ icmd .RunCmd (cmd ).Assert (t , icmd.Expected {ExitCode : 1 })
129119
130120 // with invalid src reference
131121 dockerAppImageTag ("a-simple-app$2" , "b-simple-app" )
132122 icmd .RunCmd (cmd ).Assert (t , icmd.Expected {
133123 ExitCode : 1 ,
134124 Err : `could not parse 'a-simple-app$2' as a valid reference: invalid reference format` ,
135125 })
126+ cmd .Command = dockerCli .Command ("app" , "image" , "tag" , "a-simple-app$2" , "b-simple-app" )
127+ icmd .RunCmd (cmd ).Assert (t , icmd.Expected {ExitCode : 1 })
136128
137129 // with invalid target reference
138130 dockerAppImageTag ("a-simple-app" , "b@simple-app" )
@@ -154,6 +146,8 @@ a-simple-app:latest simple
154146 ExitCode : 1 ,
155147 Err : `could not tag 'a-simple-app:not-a-tag': no such application image` ,
156148 })
149+ cmd .Command = dockerCli .Command ("app" , "image" , "tag" , "a-simple-app" , "b@simple-app" )
150+ icmd .RunCmd (cmd ).Assert (t , icmd.Expected {ExitCode : 1 })
157151
158152 // tag image with only names
159153 dockerAppImageTag ("a-simple-app" , "b-simple-app" )
@@ -194,7 +188,7 @@ c-simple-app:latest simple
194188` )
195189
196190 // given a new application
197- cmd .Command = dockerCli .Command ("app" , "bundle " , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ), "--tag" , "push-pull" , "--output" , dir . Join ( "push-pull-bundle.json" ) )
191+ cmd .Command = dockerCli .Command ("app" , "build " , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ), "--tag" , "push-pull" )
198192 icmd .RunCmd (cmd ).Assert (t , icmd .Success )
199193 expectImageListOutput (t , cmd , `APP IMAGE APP NAME
200194a-simple-app:0.1 simple
0 commit comments