From 1a852e0f2ffd96266c30928b2c951f2645022fec Mon Sep 17 00:00:00 2001 From: Djordje Lukic Date: Fri, 25 Oct 2019 17:03:54 +0200 Subject: [PATCH] Add e2e test for service container labels on run Signed-off-by: Djordje Lukic --- e2e/commands_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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)