Add test to make sure non-chaos hash deploy fails..
All checks were successful
continuous-integration/drone/push Build is passing

..and make sure _ensure_env_version passes through variable correctly.
This commit is contained in:
3wc
2025-09-03 14:18:05 -04:00
parent e858dcdd14
commit 0bb6d9609c
2 changed files with 18 additions and 1 deletions

View File

@ -174,6 +174,23 @@ teardown(){
assert_output --partial "${wantHash:0:8}" 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 # bats test_tags=slow
@test "retrieve recipe if missing" { @test "retrieve recipe if missing" {
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE" run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE"

View File

@ -30,7 +30,7 @@ _ensure_catalogue(){
} }
_ensure_env_version(){ _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" "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
assert_success assert_success
} }