diff --git a/cli/app/deploy.go b/cli/app/deploy.go index 7e68985e..edf8532f 100644 --- a/cli/app/deploy.go +++ b/cli/app/deploy.go @@ -51,6 +51,11 @@ recipes. app := internal.ValidateApp(c) stackName := app.StackName() + specificVersion := c.Args().Get(1) + if specificVersion != "" && internal.Chaos { + logrus.Fatal("cannot use and --chaos together") + } + if err := recipe.EnsureExists(app.Recipe); err != nil { logrus.Fatal(err) } @@ -112,7 +117,6 @@ recipes. } version := deployedVersion - specificVersion := c.Args().Get(1) if specificVersion != "" { version = specificVersion logrus.Debugf("choosing %s as version to deploy", version) diff --git a/cli/app/rollback.go b/cli/app/rollback.go index c8104877..f39d114b 100644 --- a/cli/app/rollback.go +++ b/cli/app/rollback.go @@ -51,6 +51,11 @@ recipes. app := internal.ValidateApp(c) stackName := app.StackName() + specificVersion := c.Args().Get(1) + if specificVersion != "" && internal.Chaos { + logrus.Fatal("cannot use and --chaos together") + } + if err := recipe.EnsureExists(app.Recipe); err != nil { logrus.Fatal(err) } @@ -125,7 +130,6 @@ recipes. logrus.Warnf("failed to determine deployed version of %s", app.Name) } - specificVersion := c.Args().Get(1) if specificVersion != "" { parsedDeployedVersion, err := tagcmp.Parse(deployedVersion) if err != nil { diff --git a/cli/app/upgrade.go b/cli/app/upgrade.go index 64065349..8c10337b 100644 --- a/cli/app/upgrade.go +++ b/cli/app/upgrade.go @@ -56,6 +56,11 @@ recipes. app := internal.ValidateApp(c) stackName := app.StackName() + specificVersion := c.Args().Get(1) + if specificVersion != "" && internal.Chaos { + logrus.Fatal("cannot use and --chaos together") + } + if !internal.Chaos { if err := recipe.EnsureIsClean(app.Recipe); err != nil { logrus.Fatal(err) @@ -126,7 +131,6 @@ recipes. logrus.Warnf("failed to determine deployed version of %s", app.Name) } - specificVersion := c.Args().Get(1) if specificVersion != "" { parsedDeployedVersion, err := tagcmp.Parse(deployedVersion) if err != nil { diff --git a/tests/integration/app_deploy.bats b/tests/integration/app_deploy.bats index 30fb9f74..8329793a 100644 --- a/tests/integration/app_deploy.bats +++ b/tests/integration/app_deploy.bats @@ -312,6 +312,13 @@ teardown(){ _undeploy_app } +@test "bail out if specific version and chaos" { + run $ABRA app deploy "$TEST_APP_DOMAIN" "0.2.0+1.21.0" \ + --chaos --no-input --no-converge-checks + assert_failure + assert_output --partial 'cannot use' +} + # bats test_tags=slow @test "COMPOSE_FILE with \$COMPOSE_FILE override works" { run sed -i 's/#COMPOSE_FILE="$COMPOSE_FILE:compose.extra_env.yml"/COMPOSE_FILE="$COMPOSE_FILE:compose.extra_env.yml"/g' \ diff --git a/tests/integration/app_rollback.bats b/tests/integration/app_rollback.bats index d6cbbef1..0439b94f 100644 --- a/tests/integration/app_rollback.bats +++ b/tests/integration/app_rollback.bats @@ -194,6 +194,13 @@ teardown(){ _undeploy_app } +@test "bail out if specific version and chaos" { + run $ABRA app rollback "$TEST_APP_DOMAIN" "0.2.0+1.21.0" \ + --chaos --no-input --no-converge-checks + assert_failure + assert_output --partial 'cannot use' +} + # bats test_tags=slow @test "rollback to previous version" { run $ABRA app deploy "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks diff --git a/tests/integration/app_upgrade.bats b/tests/integration/app_upgrade.bats index 376a75e2..0b1dafb8 100644 --- a/tests/integration/app_upgrade.bats +++ b/tests/integration/app_upgrade.bats @@ -47,6 +47,13 @@ teardown(){ _undeploy_app } +@test "bail out if specific version and chaos" { + run $ABRA app upgrade "$TEST_APP_DOMAIN" "0.2.0+1.21.0" \ + --chaos --no-input --no-converge-checks + assert_failure + assert_output --partial 'cannot use' +} + # bats test_tags=slow @test "no upgrade if lint error" { _deploy_app