Fix linter

Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
Guillaume Tardif 2020-08-21 18:52:07 +02:00
parent 7204692e3a
commit 2bac8cf94e
5 changed files with 23 additions and 26 deletions

View File

@ -87,8 +87,8 @@ func TestLoginLogout(t *testing.T) {
_ = deleteResourceGroup(rg) _ = deleteResourceGroup(rg)
}) })
res := c.RunDocker("context", "create", "aci", contextName, "--subscription-id", sID, "--resource-group", rg, "--location", location) c.RunDocker("context", "create", "aci", contextName, "--subscription-id", sID, "--resource-group", rg, "--location", location)
res = c.RunDocker("context", "use", contextName) res := c.RunDocker("context", "use", contextName)
res.Assert(t, icmd.Expected{Out: contextName}) res.Assert(t, icmd.Expected{Out: contextName})
res = c.RunDocker("context", "ls") res = c.RunDocker("context", "ls")
res.Assert(t, icmd.Expected{Out: contextName + " *"}) res.Assert(t, icmd.Expected{Out: contextName + " *"})
@ -402,9 +402,8 @@ func TestCompose(t *testing.T) {
t.Run("compose up", func(t *testing.T) { t.Run("compose up", func(t *testing.T) {
// Name of Compose project is taken from current folder "acie2e" // Name of Compose project is taken from current folder "acie2e"
res := c.RunDocker("compose", "up", "-f", composeFile) c.RunDocker("compose", "up", "-f", composeFile)
res := c.RunDocker("ps")
res = c.RunDocker("ps")
out := strings.Split(strings.TrimSpace(res.Stdout()), "\n") out := strings.Split(strings.TrimSpace(res.Stdout()), "\n")
// Check three containers are running // Check three containers are running
assert.Assert(t, is.Len(out, 4)) assert.Assert(t, is.Len(out, 4))
@ -438,9 +437,8 @@ func TestCompose(t *testing.T) {
}) })
t.Run("update", func(t *testing.T) { t.Run("update", func(t *testing.T) {
res := c.RunDocker("compose", "up", "-f", composeFileMultiplePorts, "--project-name", composeProjectName) c.RunDocker("compose", "up", "-f", composeFileMultiplePorts, "--project-name", composeProjectName)
res := c.RunDocker("ps")
res = c.RunDocker("ps")
out := strings.Split(strings.TrimSpace(res.Stdout()), "\n") out := strings.Split(strings.TrimSpace(res.Stdout()), "\n")
// Check three containers are running // Check three containers are running
assert.Assert(t, is.Len(out, 4)) assert.Assert(t, is.Len(out, 4))
@ -481,9 +479,8 @@ func TestCompose(t *testing.T) {
}) })
t.Run("down", func(t *testing.T) { t.Run("down", func(t *testing.T) {
res := c.RunDocker("compose", "down", "--project-name", composeProjectName) c.RunDocker("compose", "down", "--project-name", composeProjectName)
res := c.RunDocker("ps")
res = c.RunDocker("ps")
out := strings.Split(strings.TrimSpace(res.Stdout()), "\n") out := strings.Split(strings.TrimSpace(res.Stdout()), "\n")
assert.Equal(t, len(out), 1) assert.Equal(t, len(out), 1)
}) })
@ -584,8 +581,8 @@ func createResourceGroup(sID, rgName string) error {
} }
func createAciContextAndUseIt(t *testing.T, c *E2eCLI, sID, rgName string) { func createAciContextAndUseIt(t *testing.T, c *E2eCLI, sID, rgName string) {
res := c.RunDocker("context", "create", "aci", contextName, "--subscription-id", sID, "--resource-group", rgName, "--location", location) c.RunDocker("context", "create", "aci", contextName, "--subscription-id", sID, "--resource-group", rgName, "--location", location)
res = c.RunDocker("context", "use", contextName) res := c.RunDocker("context", "use", contextName)
res.Assert(t, icmd.Expected{Out: contextName}) res.Assert(t, icmd.Expected{Out: contextName})
res = c.RunDocker("context", "ls") res = c.RunDocker("context", "ls")
res.Assert(t, icmd.Expected{Out: contextName + " *"}) res.Assert(t, icmd.Expected{Out: contextName + " *"})

View File

@ -357,8 +357,8 @@ func TestLegacyLogin(t *testing.T) {
func TestUnsupportedCommand(t *testing.T) { func TestUnsupportedCommand(t *testing.T) {
c := NewParallelE2eCLI(t, binDir) c := NewParallelE2eCLI(t, binDir)
res := c.RunDocker("context", "create", "example", "test-example") c.RunDocker("context", "create", "example", "test-example")
res = c.RunDockerOrFail("--context", "test-example", "images") res := c.RunDockerOrFail("--context", "test-example", "images")
res.Assert(t, icmd.Expected{ res.Assert(t, icmd.Expected{
ExitCode: 1, ExitCode: 1,
Err: `Command "images" not available in current context (test-example), you can use the "default" context to run this command`, Err: `Command "images" not available in current context (test-example), you can use the "default" context to run this command`,

View File

@ -71,8 +71,8 @@ func TestSecrets(t *testing.T) {
}) })
t.Run("rm secret", func(t *testing.T) { t.Run("rm secret", func(t *testing.T) {
res := cmd.RunDocker("secret", "rm", secretName) cmd.RunDocker("secret", "rm", secretName)
res = cmd.RunDocker("secret", "list") res := cmd.RunDocker("secret", "list")
assert.Check(t, !strings.Contains(res.Stdout(), secretName)) assert.Check(t, !strings.Contains(res.Stdout(), secretName))
}) })
} }
@ -132,7 +132,7 @@ func setupTest(t *testing.T) (*E2eCLI, string) {
if localTestProfile != "" { if localTestProfile != "" {
region := os.Getenv("TEST_AWS_REGION") region := os.Getenv("TEST_AWS_REGION")
assert.Check(t, region != "") assert.Check(t, region != "")
res = c.RunDocker("context", "create", "ecs", contextName, "--profile", localTestProfile, "--region", region) c.RunDocker("context", "create", "ecs", contextName, "--profile", localTestProfile, "--region", region)
} else { } else {
profile := contextName profile := contextName
region := os.Getenv("AWS_DEFAULT_REGION") region := os.Getenv("AWS_DEFAULT_REGION")
@ -141,7 +141,7 @@ func setupTest(t *testing.T) (*E2eCLI, string) {
assert.Check(t, keyID != "") assert.Check(t, keyID != "")
assert.Check(t, secretKey != "") assert.Check(t, secretKey != "")
assert.Check(t, region != "") assert.Check(t, region != "")
res = c.RunDocker("context", "create", "ecs", contextName, "--profile", profile, "--region", region, "--secret-key", secretKey, "--key-id", keyID) c.RunDocker("context", "create", "ecs", contextName, "--profile", profile, "--region", region, "--secret-key", secretKey, "--key-id", keyID)
} }
res = c.RunDocker("context", "use", contextName) res = c.RunDocker("context", "use", contextName)
res.Assert(t, icmd.Expected{Out: contextName}) res.Assert(t, icmd.Expected{Out: contextName})