From ed395a1e64ed0ade298c1c693502c4e9348fefea Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Wed, 26 Aug 2020 18:03:57 +0200 Subject: [PATCH] Display nice message on context creation (message taken from Moby cli) Signed-off-by: Guillaume Tardif --- cli/cmd/context/create.go | 1 + tests/aci-e2e/e2e-aci_test.go | 7 ++++--- tests/ecs-e2e/e2e-ecs_test.go | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cli/cmd/context/create.go b/cli/cmd/context/create.go index 01f2383c..5723e16b 100644 --- a/cli/cmd/context/create.go +++ b/cli/cmd/context/create.go @@ -135,6 +135,7 @@ func createDockerContext(ctx context.Context, name string, contextType string, d description, data, ) + fmt.Printf("Successfully created %s context %q\n", contextType, name) return result } diff --git a/tests/aci-e2e/e2e-aci_test.go b/tests/aci-e2e/e2e-aci_test.go index 91bdcd6e..93a45013 100644 --- a/tests/aci-e2e/e2e-aci_test.go +++ b/tests/aci-e2e/e2e-aci_test.go @@ -124,7 +124,7 @@ func TestLoginLogout(t *testing.T) { }) } -func TestContainerRun(t *testing.T) { +func TestContainerRunVolume(t *testing.T) { c := NewParallelE2eCLI(t, binDir) sID, rg := setupTestResourceGroup(t, c) @@ -581,8 +581,9 @@ func createResourceGroup(sID, rgName string) error { } func createAciContextAndUseIt(t *testing.T, c *E2eCLI, sID, rgName string) { - c.RunDockerCmd("context", "create", "aci", contextName, "--subscription-id", sID, "--resource-group", rgName, "--location", location) - res := c.RunDockerCmd("context", "use", contextName) + res := c.RunDockerCmd("context", "create", "aci", contextName, "--subscription-id", sID, "--resource-group", rgName, "--location", location) + res.Assert(t, icmd.Expected{Out: "Successfully created aci context \"" + contextName + "\""}) + res = c.RunDockerCmd("context", "use", contextName) res.Assert(t, icmd.Expected{Out: contextName}) res = c.RunDockerCmd("context", "ls") res.Assert(t, icmd.Expected{Out: contextName + " *"}) diff --git a/tests/ecs-e2e/e2e-ecs_test.go b/tests/ecs-e2e/e2e-ecs_test.go index 5bb1fb3c..fea87c15 100644 --- a/tests/ecs-e2e/e2e-ecs_test.go +++ b/tests/ecs-e2e/e2e-ecs_test.go @@ -131,7 +131,7 @@ func setupTest(t *testing.T) (*E2eCLI, string) { if localTestProfile != "" { region := os.Getenv("TEST_AWS_REGION") assert.Check(t, region != "") - c.RunDockerCmd("context", "create", "ecs", contextName, "--profile", localTestProfile, "--region", region) + res = c.RunDockerCmd("context", "create", "ecs", contextName, "--profile", localTestProfile, "--region", region) } else { profile := contextName region := os.Getenv("AWS_DEFAULT_REGION") @@ -140,8 +140,9 @@ func setupTest(t *testing.T) (*E2eCLI, string) { assert.Check(t, keyID != "") assert.Check(t, secretKey != "") assert.Check(t, region != "") - c.RunDockerCmd("context", "create", "ecs", contextName, "--profile", profile, "--region", region, "--secret-key", secretKey, "--key-id", keyID) + res = c.RunDockerCmd("context", "create", "ecs", contextName, "--profile", profile, "--region", region, "--secret-key", secretKey, "--key-id", keyID) } + res.Assert(t, icmd.Expected{Out: "Successfully created ecs context \"" + contextName + "\""}) res = c.RunDockerCmd("context", "use", contextName) res.Assert(t, icmd.Expected{Out: contextName}) res = c.RunDockerCmd("context", "ls")