From 0bb6d9609c98494c39aa87952ec43ff9cd3051d4 Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Wed, 3 Sep 2025 14:18:05 -0400 Subject: [PATCH] Add test to make sure non-chaos hash deploy fails.. ..and make sure _ensure_env_version passes through variable correctly. --- tests/integration/app_deploy.bats | 17 +++++++++++++++++ tests/integration/helpers/recipe.bash | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/integration/app_deploy.bats b/tests/integration/app_deploy.bats index 43c0a9f8..17a75eeb 100644 --- a/tests/integration/app_deploy.bats +++ b/tests/integration/app_deploy.bats @@ -174,6 +174,23 @@ teardown(){ assert_output --partial "${wantHash:0:8}" } +# bats test_tags=slow +@test "bail if env has a hash but no --chaos" { + wantHash=$(_get_n_hash 3) + + run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3 + assert_success + + assert_equal $(_get_current_hash) "$wantHash" + + _ensure_env_version "$wantHash" + + run $ABRA app deploy "$TEST_APP_DOMAIN" \ + --no-input --no-converge-checks + assert_failure + assert_output --partial "chaos commit" +} + # bats test_tags=slow @test "retrieve recipe if missing" { run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE" diff --git a/tests/integration/helpers/recipe.bash b/tests/integration/helpers/recipe.bash index bbd68342..4d430cd6 100644 --- a/tests/integration/helpers/recipe.bash +++ b/tests/integration/helpers/recipe.bash @@ -30,7 +30,7 @@ _ensure_catalogue(){ } _ensure_env_version(){ - run sed -i 's/TYPE=abra-test-recipe:.*/TYPE=abra-test-recipe:$1/g' \ + run sed -i "s/TYPE=abra-test-recipe:.*/TYPE=abra-test-recipe:$1/g" \ "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" assert_success }