Display nice message on context creation (message taken from Moby cli)

Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
Guillaume Tardif 2020-08-26 18:03:57 +02:00
parent 970ac218d3
commit ed395a1e64
3 changed files with 8 additions and 5 deletions

View File

@ -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
}

View File

@ -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 + " *"})

View File

@ -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")