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

@ -1,9 +1,9 @@
#!/usr/bin/env bash
teardown_file() {
setup_file(){
load "$PWD/tests/integration/helpers/common"
_common_setup
_reset_recipe
_fetch_recipe
}
setup() {
@ -11,6 +11,10 @@ setup() {
_common_setup
}
teardown(){
_reset_recipe
}
@test "recipe lint" {
run $ABRA recipe lint gitea
assert_success
@ -62,35 +66,31 @@ 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 recipe lint "$TEST_RECIPE"
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 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 recipe lint "$TEST_RECIPE" --offline
assert_success
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
assert_output --regexp 'behind .* 3 commits'
_reset_recipe
assert_equal $(_get_current_hash) "$wantHash"
}
@test "recipe lint warns on error" {
@ -103,6 +103,4 @@ setup() {
run $ABRA recipe lint "$TEST_RECIPE" --chaos
assert_success --partial 'watch out, some critical errors are present'
_checkout_recipe
}