From e1f900de147bcbd5d43ad0b9ffe6c06b7376615e Mon Sep 17 00:00:00 2001 From: decentral1se Date: Mon, 25 Sep 2023 16:32:16 +0200 Subject: [PATCH] test: fix app_secret generate tests [ci skip] --- tests/integration/app_secret.bats | 30 ++++++++++++++++++++++-------- tests/integration/helpers/app.bash | 14 -------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/integration/app_secret.bats b/tests/integration/app_secret.bats index db2bf98a..23451ad8 100644 --- a/tests/integration/app_secret.bats +++ b/tests/integration/app_secret.bats @@ -4,7 +4,13 @@ setup_file(){ load "$PWD/tests/integration/helpers/common" _common_setup _add_server - _new_app + + run $ABRA app new "$TEST_RECIPE" \ + --no-input \ + --server "$TEST_SERVER" \ + --domain "$TEST_APP_DOMAIN" \ + assert_success + assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" } teardown_file(){ @@ -18,9 +24,19 @@ teardown(){ if [[ -z "${BATS_TEST_COMPLETED}" ]]; then _undeploy_app fi +} - # NOTE(d1): teardown secrets from "--secrets" in _new_app - run $ABRA app secret rm "$TEST_APP_DOMAIN" --all +_reset_app(){ + 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" + + run $ABRA app new "$TEST_RECIPE" \ + --no-input \ + --server "$TEST_SERVER" \ + --domain "$TEST_APP_DOMAIN" \ + assert_success + assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" } setup(){ @@ -109,10 +125,8 @@ setup(){ run docker -c "$TEST_SERVER" secret ls assert_success - assert_output --partial "test_pass_one_v2" - - sanitisedDomainName="${TEST_APP_DOMAIN//./_}" - refute_output --partial "$sanitisedDomainName_test_pass_one_v1" + assert_output --regexp ".*_test_pass_one_v2" + refute_output --regexp ".*_test_pass_one_v1" run $ABRA app secret rm "$TEST_APP_DOMAIN" --all assert_success @@ -162,7 +176,7 @@ setup(){ run $ABRA app secret generate "$TEST_APP_DOMAIN" --all --chaos assert_success - refute_output --partial 'test_pass_one' + assert_output --partial 'test_pass_one not enabled in recipe config' assert_output --partial 'test_pass_two' run $ABRA app secret rm "$TEST_APP_DOMAIN" --all --chaos diff --git a/tests/integration/helpers/app.bash b/tests/integration/helpers/app.bash index 281e4e6a..17dbbc2f 100644 --- a/tests/integration/helpers/app.bash +++ b/tests/integration/helpers/app.bash @@ -40,17 +40,3 @@ _rm_app() { run $ABRA app remove "$TEST_APP_DOMAIN" --no-input fi } - -_reset_app(){ - 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" - - run $ABRA app new "$TEST_RECIPE" \ - --no-input \ - --server "$TEST_SERVER" \ - --domain "$TEST_APP_DOMAIN" \ - --secrets - assert_success - assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" -}