test: return/echo from git helper functions

This commit is contained in:
2024-06-22 17:02:15 +02:00
parent aa3910f8df
commit 9ec99c7712
2 changed files with 11 additions and 14 deletions

View File

@ -50,9 +50,7 @@ teardown(){
assert_success
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
_get_tag_hash 0.1.1+1.20.2
_get_current_hash
assert_equal "$tagHash" "$currentHash"
assert_equal $(_get_tag_hash 0.1.1+1.20.2) $(_get_current_hash)
}
@test "does not overwrite existing env files" {
@ -113,13 +111,12 @@ teardown(){
@test "ensure recipe up to date if no --offline" {
_reset_recipe
_get_n_hash 3
wantHash=$(_get_n_hash 3)
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
assert_success
_get_current_hash
assert_equal "$currentHash" "$nHash"
assert_equal $(_get_current_hash) "$wantHash"
run $ABRA app new "$TEST_RECIPE" \
--no-input \
@ -128,22 +125,19 @@ teardown(){
assert_success
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
_get_head_hash
_get_current_hash
assert_equal "$HEAD_HASH" "$CURRENT_HASH"
assert_equal $(_get_head_hash) $(_get_current_hash)
_reset_recipe
}
@test "ensure recipe not up to date if --offline" {
_reset_recipe
_get_n_hash 3
wantHash=$(_get_n_hash 3)
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
assert_success
_get_current_hash
assert_equal "$currentHash" "$nHash"
assert_equal $(_get_current_hash) "$wantHash"
# NOTE(d1): need to use --chaos to force same commit
run $ABRA app new "$TEST_RECIPE" \
@ -155,8 +149,7 @@ teardown(){
assert_success
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
_get_current_hash
assert_equal "$currentHash" "$nHash"
assert_equal $(_get_current_hash) "$wantHash"
_reset_recipe
}