Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 68ecf62

Browse files
committed
Adjust e2e tests 'bundle' being replaced by 'build'
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
1 parent 9d6eb02 commit 68ecf62

2 files changed

Lines changed: 23 additions & 29 deletions

File tree

e2e/images_test.go

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4028
func 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`,
9684
func 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
200194
a-simple-app:0.1 simple

e2e/pushpull_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func TestPushInstallBundle(t *testing.T) {
194194
bundleFile := tmpDir.Join("bundle.json")
195195

196196
// render the app to a bundle, we use the app from the push pull test above.
197-
cmd.Command = dockerCli.Command("app", "bundle", "-o", bundleFile, filepath.Join("testdata", "push-pull", "push-pull.dockerapp"))
197+
cmd.Command = dockerCli.Command("app", "build", "-o", bundleFile, filepath.Join("testdata", "push-pull", "push-pull.dockerapp"))
198198
icmd.RunCmd(cmd).Assert(t, icmd.Success)
199199

200200
// push it and install to check it is available
@@ -242,7 +242,7 @@ func TestPushInstallBundle(t *testing.T) {
242242
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-
cmdIsolatedStore.Command = dockerCli.Command("app", "bundle", "--tag", ref2, "-o", bundleFile, filepath.Join("testdata", "push-pull", "push-pull.dockerapp"))
245+
cmdIsolatedStore.Command = dockerCli.Command("app", "build", "--tag", ref2, filepath.Join("testdata", "push-pull", "push-pull.dockerapp"))
246246
icmd.RunCmd(cmdIsolatedStore).Assert(t, icmd.Success)
247247
// Push the app without tagging it explicitly
248248
cmdIsolatedStore.Command = dockerCli.Command("app", "push", ref2)

0 commit comments

Comments
 (0)