Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Add e2e test for service container labels on run
Browse files Browse the repository at this point in the history
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
  • Loading branch information
rumpl committed Oct 28, 2019
1 parent b1d4b76 commit 8ce977e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
25 changes: 25 additions & 0 deletions e2e/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions internal/packager/testdata/bundle-json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 8ce977e

Please sign in to comment.