@@ -20,31 +20,58 @@ b-simple-app latest simple
20
20
`
21
21
)
22
22
23
+ func insertBundles (t * testing.T , cmd icmd.Cmd , dir * fs.Dir , info dindSwarmAndRegistryInfo ) string {
24
+ // Push an application so that we can later pull it by digest
25
+ cmd .Command = dockerCli .Command ("app" , "push" , "--tag" , info .registryAddress + "/c-myapp" , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ))
26
+ r := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
27
+
28
+ // Get the digest from the output of the pull command
29
+ out := r .Stdout ()
30
+ matches := reg .FindAllStringSubmatch (out , 1 )
31
+ digest := matches [0 ][1 ]
32
+
33
+ // Pull the app by digest
34
+ cmd .Command = dockerCli .Command ("app" , "pull" , info .registryAddress + "/c-myapp@" + digest )
35
+ icmd .RunCmd (cmd ).Assert (t , icmd .Success )
36
+
37
+ cmd .Command = dockerCli .Command ("app" , "bundle" , filepath .Join ("testdata" , "simple" , "simple.dockerapp" ), "--tag" , "b-simple-app" , "--output" , dir .Join ("simple-bundle.json" ))
38
+ icmd .RunCmd (cmd ).Assert (t , icmd .Success )
39
+ cmd .Command = dockerCli .Command ("app" , "bundle" , filepath .Join ("testdata" , "simple" , "simple.dockerapp" ), "--tag" , "a-simple-app" , "--output" , dir .Join ("simple-bundle.json" ))
40
+ icmd .RunCmd (cmd ).Assert (t , icmd .Success )
41
+
42
+ return digest
43
+ }
44
+
23
45
func TestImageList (t * testing.T ) {
24
46
runWithDindSwarmAndRegistry (t , func (info dindSwarmAndRegistryInfo ) {
25
47
cmd := info .configuredCmd
26
48
dir := fs .NewDir (t , "" )
27
49
defer dir .Remove ()
28
50
29
- // Push an application so that we can later pull it by digest
30
- cmd .Command = dockerCli .Command ("app" , "push" , "--tag" , info .registryAddress + "/c-myapp" , filepath .Join ("testdata" , "push-pull" , "push-pull.dockerapp" ))
31
- r := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
51
+ insertBundles (t , cmd , dir , info )
52
+
53
+ expectedOutput := fmt .Sprintf (expected , info .registryAddress + "/c-myapp" )
54
+ cmd .Command = dockerCli .Command ("app" , "image" , "ls" )
55
+ result := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
56
+ assert .Equal (t , result .Stdout (), expectedOutput )
57
+ })
58
+ }
59
+
60
+ func TestImageRm (t * testing.T ) {
61
+ runWithDindSwarmAndRegistry (t , func (info dindSwarmAndRegistryInfo ) {
62
+ cmd := info .configuredCmd
63
+ dir := fs .NewDir (t , "" )
64
+ defer dir .Remove ()
32
65
33
- // Get the digest from the output of the pull command
34
- out := r .Stdout ()
35
- matches := reg .FindAllStringSubmatch (out , 1 )
36
- digest := matches [0 ][1 ]
66
+ digest := insertBundles (t , cmd , dir , info )
37
67
38
- // Pull the app by digest
39
- cmd .Command = dockerCli .Command ("app" , "pull" , info .registryAddress + "/c-myapp@" + digest )
68
+ cmd .Command = dockerCli .Command ("app" , "image" , "rm" , info .registryAddress + "/c-myapp@" + digest )
40
69
icmd .RunCmd (cmd ).Assert (t , icmd .Success )
41
70
42
- cmd .Command = dockerCli .Command ("app" , "bundle" , filepath .Join ("testdata" , "simple" , "simple.dockerapp" ), "--tag" , "b-simple-app" , "--output" , dir .Join ("simple-bundle.json" ))
43
- icmd .RunCmd (cmd ).Assert (t , icmd .Success )
44
- cmd .Command = dockerCli .Command ("app" , "bundle" , filepath .Join ("testdata" , "simple" , "simple.dockerapp" ), "--tag" , "a-simple-app" , "--output" , dir .Join ("simple-bundle.json" ))
71
+ cmd .Command = dockerCli .Command ("app" , "image" , "rm" , "a-simple-app:latest" , "b-simple-app:latest" )
45
72
icmd .RunCmd (cmd ).Assert (t , icmd .Success )
46
73
47
- expectedOutput := fmt . Sprintf ( expected , info . registryAddress + "/c-myapp" )
74
+ expectedOutput := "REPOSITORY TAG APP NAME \n "
48
75
cmd .Command = dockerCli .Command ("app" , "image" , "ls" )
49
76
result := icmd .RunCmd (cmd ).Assert (t , icmd .Success )
50
77
assert .Equal (t , result .Stdout (), expectedOutput )
0 commit comments