test: less fragile integration suite [ci skip]

See coop-cloud/organising#584
See coop-cloud/organising#595
This commit is contained in:
2024-06-22 16:40:07 +02:00
parent a9ce2106c6
commit 2014cd6622
39 changed files with 249 additions and 425 deletions

View File

@ -18,6 +18,10 @@ setup(){
_common_setup
}
teardown(){
_reset_recipe
}
@test "validate app argument" {
run $ABRA app check
assert_failure
@ -35,8 +39,6 @@ setup(){
run $ABRA app check "$TEST_APP_DOMAIN"
assert_success
refute_output --partial '❌'
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
}
@ -66,37 +68,33 @@ setup(){
}
@test "ensure recipe up to date if no --offline" {
wantHash=$(_get_n_hash 3)
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
assert_success
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
assert_output --regexp 'behind .* 3 commits'
assert_equal $(_get_current_hash) "$wantHash"
run $ABRA app check "$TEST_APP_DOMAIN"
assert_success
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
assert_output --regexp 'behind .* 3 commits'
_reset_recipe
assert_equal $(_get_head_hash) $(_get_current_hash)
}
@test "ensure recipe not up to date if --offline" {
wantHash=$(_get_n_hash 1)
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~1
assert_success
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
assert_output --partial "Your branch is behind 'origin/main' by 1 commit"
assert_equal $(_get_current_hash) "$wantHash"
# NOTE(d1): we can't quite tell if this will fail or not in the future, so,
# since it isn't an important part of what we're testing here, we don't check
# it
run $ABRA app check "$TEST_APP_DOMAIN" --offline
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
assert_output --partial "Your branch is behind 'origin/main' by 1 commit"
_reset_recipe
assert_equal $(_get_current_hash) "$wantHash"
}
@test "error if missing .env.sample" {
@ -106,8 +104,6 @@ setup(){
run $ABRA app check "$TEST_APP_DOMAIN" --chaos
assert_failure
assert_output --partial '.env.sample does not exist?'
_checkout_recipe
}
@test "error if missing env var" {
@ -121,6 +117,4 @@ setup(){
run $ABRA app check "$TEST_APP_DOMAIN" --chaos
assert_success
assert_output --partial '❌'
_checkout_recipe
}