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

@ -19,10 +19,8 @@ setup(){
}
teardown(){
# https://github.com/bats-core/bats-core/issues/383#issuecomment-738628888
if [[ -z "${BATS_TEST_COMPLETED}" ]]; then
_undeploy_app
fi
_undeploy_app
_reset_recipe
}
# bats test_tags=slow
@ -92,35 +90,33 @@ test_cmd_export"
}
@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 cmd --local "$TEST_APP_DOMAIN" test_cmd
assert_success
assert_output --partial 'baz'
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
assert_output --partial "up to date"
_reset_recipe "$TEST_RECIPE"
assert_equal $(_get_head_hash) $(_get_current_hash)
}
@test "ensure recipe not up to date if --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 cmd --local --offline "$TEST_APP_DOMAIN" test_cmd
assert_success
assert_output --partial 'baz'
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
assert_output --regexp 'behind .* 3 commits'
assert_equal $(_get_current_hash) $wantHash
_reset_recipe "$TEST_RECIPE"
}
@ -167,12 +163,16 @@ test_cmd_export"
}
@test "run command with single arg" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/581"
run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd_arg -- bing
assert_success
assert_output --partial 'bing'
}
@test "run command with several args" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/581"
run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd_args -- bong bang
assert_success
assert_output --partial 'bong bang'
@ -185,8 +185,6 @@ test_cmd_export"
run $ABRA app cmd "$TEST_APP_DOMAIN" app test_cmd
assert_success
assert_output --partial 'baz'
_undeploy_app
}
# bats test_tags=slow
@ -196,6 +194,4 @@ test_cmd_export"
run $ABRA app cmd "$TEST_APP_DOMAIN" doesnt_exist test_cmd
assert_failure
assert_output --partial 'no service doesnt_exist'
_undeploy_app
}