diff --git a/e2e/commands_test.go b/e2e/commands_test.go index c2f998fa2..be7721dfb 100644 --- a/e2e/commands_test.go +++ b/e2e/commands_test.go @@ -194,6 +194,31 @@ func TestRunOnlyOne(t *testing.T) { }) } +func TestRunWithLabels(t *testing.T) { + runWithDindSwarmAndRegistry(t, func(info dindSwarmAndRegistryInfo) { + cmd := info.configuredCmd + + contextPath := filepath.Join("testdata", "simple") + cmd.Command = dockerCli.Command("app", "build", "--tag", "myapp", contextPath) + icmd.RunCmd(cmd).Assert(t, icmd.Success) + + cmd.Command = dockerCli.Command("app", "run", "myapp", "--name", "myapp", "--label", "label.key=labelValue") + icmd.RunCmd(cmd).Assert(t, icmd.Success) + + services := []string{ + "myapp_db", "myapp_web", "myapp_api", + } + for _, service := range services { + fmt.Printf("%q", service) + cmd.Command = dockerCli.Command("inspect", service) + icmd.RunCmd(cmd).Assert(t, icmd.Expected{ + ExitCode: 0, + Out: `"label.key": "labelValue"`, + }) + } + }) +} + func TestDockerAppLifecycle(t *testing.T) { t.Run("withBindMounts", func(t *testing.T) { testDockerAppLifecycle(t, true) diff --git a/internal/packager/testdata/bundle-json.golden b/internal/packager/testdata/bundle-json.golden index d070f5049..e99d116c7 100644 --- a/internal/packager/testdata/bundle-json.golden +++ b/internal/packager/testdata/bundle-json.golden @@ -51,6 +51,16 @@ "io.cnab.status": {} }, "parameters": { + "com.docker.app.args": { + "definition": "com.docker.app.args", + "applyTo": [ + "install", + "upgrade" + ], + "destination": { + "path": "/cnab/app/args.json" + } + }, "com.docker.app.inspect-format": { "definition": "com.docker.app.inspect-format", "applyTo": [ @@ -115,6 +125,12 @@ } }, "definitions": { + "com.docker.app.args": { + "default": "", + "description": "Labels to apply to service containers", + "title": "Labels", + "type": "string" + }, "com.docker.app.inspect-format": { "default": "json", "description": "Output format for the inspect command",