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,13 +19,12 @@ setup(){
}
teardown(){
# https://github.com/bats-core/bats-core/issues/383#issuecomment-738628888
if [[ -z "${BATS_TEST_COMPLETED}" ]]; then
_undeploy_app
fi
_undeploy_app
}
@test "validate app argument" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run $ABRA app restore
assert_failure
assert_output --partial 'no app provided'
@ -36,6 +35,8 @@ teardown(){
}
@test "retrieve recipe if missing" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE"
assert_success
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE"
@ -46,6 +47,8 @@ teardown(){
}
@test "bail if unstaged changes and no --chaos" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run bash -c "echo foo >> $ABRA_DIR/recipes/$TEST_RECIPE/foo"
assert_success
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
@ -66,6 +69,8 @@ teardown(){
# bats test_tags=slow
@test "do not bail if unstaged changes and --chaos" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run bash -c 'echo "unstaged changes" >> "$ABRA_DIR/recipes/$TEST_RECIPE/foo"'
assert_success
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
@ -105,6 +110,8 @@ teardown(){
}
@test "ensure recipe up to date if no --offline" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
assert_success
@ -119,6 +126,8 @@ teardown(){
}
@test "ensure recipe not up to date if --offline" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
latestCommit="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)"
refute [ -z "$latestCommit" ];
@ -142,6 +151,8 @@ teardown(){
}
@test "error if missing service" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run $ABRA app restore "$TEST_APP_DOMAIN"
assert_failure
assert_output --partial 'missing <service>'
@ -152,6 +163,8 @@ teardown(){
}
@test "error if file doesn't exist" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run $ABRA app restore "$TEST_APP_DOMAIN" app DOESNTEXIST
assert_failure
assert_output --partial "doesn't exist"
@ -159,6 +172,8 @@ teardown(){
# bats test_tags=slow
@test "detect labels if restore enabled" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run touch "$BATS_TMPDIR/foo.txt"
assert_success
assert_exists "$BATS_TMPDIR/foo.txt"
@ -180,6 +195,8 @@ teardown(){
# bats test_tags=slow
@test "no error if restore not enabled" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run sed -i '/backupbot.restore=.*/d' "$ABRA_DIR/recipes/$TEST_RECIPE/compose.yml"
assert_success
@ -208,6 +225,8 @@ teardown(){
# bats test_tags=slow
@test "error if service doesn't exist" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run touch "$BATS_TMPDIR/foo.txt"
assert_success
assert_exists "$BATS_TMPDIR/foo.txt"
@ -227,6 +246,8 @@ teardown(){
# bats test_tags=slow
@test "restore backup" {
skip "https://git.coopcloud.tech/coop-cloud/organising/issues/583"
run touch "$BATS_TMPDIR/foo.txt"
assert_success
assert_exists "$BATS_TMPDIR/foo.txt"