test: tag/git helpers & refactor [ci skip]

This commit is contained in:
2023-09-23 23:19:49 +02:00
parent 575bfbb0fb
commit ce7b4733d7
8 changed files with 52 additions and 75 deletions

View File

@ -86,12 +86,7 @@ teardown(){
run $ABRA app deploy "$TEST_APP_DOMAIN" --no-input --no-converge-checks
assert_success
# NOTE(d1): nuke it to ensure clean git state
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE"
assert_success
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
_fetch_recipe "$TEST_RECIPE"
_reset_recipe "$TEST_RECIPE"
_undeploy_app
}
@ -112,30 +107,14 @@ teardown(){
assert_output --partial 'behind 3'
_undeploy_app
# NOTE(d1): nuke it to ensure clean git state
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE"
assert_success
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
_fetch_recipe "$TEST_RECIPE"
_reset_recipe "$TEST_RECIPE"
}
# bats test_tags=slow
@test "deploy latest commit if no published versions and no --chaos" {
latestCommit="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)"
run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | wc -l'
assert_success
refute_output '0'
run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | \
xargs -I{} git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -d {}'
assert_success
assert_output --partial 'Deleted tag'
run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | wc -l'
assert_success
assert_output '0'
_remove_tags
# NOTE(d1): need to pass --offline to stop tags being pulled again
run $ABRA app deploy "$TEST_APP_DOMAIN" \
@ -146,13 +125,7 @@ teardown(){
refute_output --partial 'chaos'
_undeploy_app
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" fetch --all
assert_success
run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | wc -l'
assert_success
refute_output '0'
_reset_tags
}
# bats test_tags=slow
@ -175,12 +148,7 @@ teardown(){
assert_output --partial 'chaos'
_undeploy_app
# NOTE(d1): nuke it to ensure clean git state
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE"
assert_success
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
_fetch_recipe "$TEST_RECIPE"
_reset_recipe
}
# bats test_tags=slow