From 0a371ec360fb23350ab8f8f028bb35394d7e3cc9 Mon Sep 17 00:00:00 2001 From: p4u1 Date: Thu, 13 Mar 2025 08:31:11 +0100 Subject: [PATCH] fix: integration tests --- cli/app/deploy.go | 4 ++++ cli/app/rollback.go | 2 +- tests/integration/app_deploy_overview.bats | 4 ++-- tests/integration/app_rollback.bats | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cli/app/deploy.go b/cli/app/deploy.go index 42ee02f8..e1413c2f 100644 --- a/cli/app/deploy.go +++ b/cli/app/deploy.go @@ -3,6 +3,7 @@ package app import ( "context" "fmt" + "strings" "coopcloud.tech/abra/cli/internal" "coopcloud.tech/abra/pkg/app" @@ -275,6 +276,9 @@ func getDeployVersion(cliArgs []string, deployMeta stack.DeployMeta, app app.App // Check if the recipe has a version in the .env file if app.Recipe.EnvVersion != "" && !internal.IgnoreEnvVersion { + if strings.HasSuffix(app.Recipe.EnvVersionRaw, "+U") { + return "", fmt.Errorf("version: can not redeploy chaos version %s", app.Recipe.EnvVersionRaw) + } log.Debugf("version: taking version from .env file: %s", app.Recipe.EnvVersion) return app.Recipe.EnvVersion, nil } diff --git a/cli/app/rollback.go b/cli/app/rollback.go index f556735e..1fd2c7dd 100644 --- a/cli/app/rollback.go +++ b/cli/app/rollback.go @@ -242,7 +242,7 @@ func validateDowngradeVersionArg( ) error { parsedDeployedVersion, err := tagcmp.Parse(deployMeta.Version) if err != nil { - return fmt.Errorf("'%s' is not a known version for %s", deployMeta.Version, app.Recipe.Name) + return fmt.Errorf("current deployment '%s' is not a known version for %s", deployMeta.Version, app.Recipe.Name) } parsedSpecificVersion, err := tagcmp.Parse(specificVersion) diff --git a/tests/integration/app_deploy_overview.bats b/tests/integration/app_deploy_overview.bats index c5fa692a..8d5355c8 100644 --- a/tests/integration/app_deploy_overview.bats +++ b/tests/integration/app_deploy_overview.bats @@ -154,7 +154,7 @@ teardown(){ assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" run $ABRA app deploy "$TEST_APP_DOMAIN" \ - --no-input --no-converge-checks --force + --no-input --no-converge-checks --force --debug assert_failure assert_output --regexp 'can not redeploy chaos version .*' + "${headHash:0:8}+U" } @@ -249,7 +249,7 @@ teardown(){ --no-input --no-converge-checks --force assert_success - assert_output --partial 'CHAOS DEPLOY OVERVIEW' + assert_output --partial 'REDEPLOY OVERVIEW' assert_output --partial "CURRENT DEPLOYMENT ${headHash:0:8}" assert_output --partial "ENV VERSION ${headHash:0:8}" assert_output --partial "NEW DEPLOYMENT ${headHash:0:8}" diff --git a/tests/integration/app_rollback.bats b/tests/integration/app_rollback.bats index c8971b46..a8f3a81f 100644 --- a/tests/integration/app_rollback.bats +++ b/tests/integration/app_rollback.bats @@ -164,8 +164,7 @@ teardown(){ run $ABRA app rollback "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks assert_failure - assert_output --partial "0.1.1+1.20.2" - assert_output --partial "${tagHash:0:8}" + 'is not a known version' + assert_output --partial 'current deployment' + "${tagHash:0:8}" + 'is not a known version' } # bats test_tags=slow