From f5c39d8f1a66ab691f3978d3ad309fb2ee87a5ba Mon Sep 17 00:00:00 2001 From: decentral1se Date: Tue, 12 Aug 2025 22:15:51 +0200 Subject: [PATCH] test: check app list doesn't explode if missing .env See https://git.coopcloud.tech/toolshed/abra/issues/560 --- tests/integration/app_list.bats | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/integration/app_list.bats b/tests/integration/app_list.bats index b3f1034b..c4e7bb81 100644 --- a/tests/integration/app_list.bats +++ b/tests/integration/app_list.bats @@ -8,6 +8,10 @@ setup_file(){ } teardown_file(){ + if [[ ! -f "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" ]]; then + _new_app + fi + _undeploy_app _rm_app _rm_server @@ -19,6 +23,10 @@ setup(){ } teardown(){ + if [[ ! -f "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" ]]; then + _new_app + fi + _reset_recipe _undeploy_app } @@ -137,3 +145,21 @@ teardown(){ assert_success assert_not_exists "$ABRA_DIR/servers/foo.com" } + +# bats test_tags=slow +@test "list does not fail if missing .env" { + _deploy_app + + run $ABRA app ls --status + assert_success + + run rm -rf "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" + assert_success + assert_not_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" + + output=$("$ABRA" app ls --server "$TEST_SERVER" --status --machine) + run diff \ + <(jq -S "." <(echo "$output")) \ + <(jq -S "." <(echo '{}')) + assert_success +}