forked from toolshed/abra
		
	fix-integration-tests (!403)
In preparation for the new abra release, let's fix all integration tests After merging, this needs to be cherry-picked into the release-0-9 branch. - [x] app_backup.bats (skip this one) - [x] app_check.bats (fixed bybd21014fed) - [x] app_cmd.bats (partially fixed in08232b74f6), has known regression coop-cloud/organising#581 - [x] app_config.bats (no changes needed) - [x] app_cp.bats (no changes needed) - [x] app_deploy.bats - [x] app_errors.bats (no changes needed) - [x] app_list.bats (no changes needed) - [x] app_logs.bats (no changes needed) - [x] app_new.bats (no changes needed) - [x] app_ps.bats (no changes needed) - [x] app_remove.bats (fixed by [2f29fbeb2e](coop-cloud/abra#403/commits/2f29fbeb2e018656413fa25f8615b7a98cdcb083)) - [x] app_restart.bats (no changes needed - [x] app_restore.bats (fixed by [f2dd5afc38](coop-cloud/abra#403/commits/f2dd5afc38a25a8316899fa0c6d59499445868d7)) - [x] app_rollback.bats (partially fixed by6e99b74c24) - [x] app_run.bats (no changes needed) - [x] app_secret.bats (fixed bybd069d32f6) - [x] app_services.bats (no changes needed) - [x] app_undeploy.bats (no changes needed) - [x] app_upgrade.bats (no changes needed) - [x] app_version.bats (partially fixed byad323ad2bd) - [x] app_volume.bats (fixed by [03c3823770](coop-cloud/abra#403/commits/03c38237707ae795b723180eb07a7edc84a8de35)) - [x] autocomplete.bats (no changes needed) - [x] catalogue.bats (no changes needed) - [x] dirs.bats (no changes needed) - [x] install.bats (failes, but is expected) - [x] recipe_diff.bats (no changes needed) - [x] recipe_fetch.bats (no changes needed) - [x] recipe_lint.bats (fixed by [b6b0808066](coop-cloud/abra#403/commits/b6b0808066a11e4bcd77517ec39600d500bcb944)) - [x] recipe_list.bats (no changes needed) - [x] recipe_new.bats (fixed by [0aac464ded](coop-cloud/abra#403/commits/0aac464ded6b43afb3ec37ade2f64d6191b9838f)) - [x] recipe_release.bats (no changes needed) - [x] recipe_reset.bats (no changes needed) - [x] recipe_sync.bats (no changes needed) - [x] recipe_upgrade.bats (fixed by [ab86904cf4](coop-cloud/abra#403/commits/ab86904cf45db89c7c189ca1fd9971909bd446dd)) - [x] recipe_version.bats (fixed by81897bf4da) - [x] server_add.bats - [x] server_list.bats - [x] server_prune.bats (no changes needed) - [x] server_remove.bats - [x] upgrade.bats - [x] version.bats (no changes needed) Co-authored-by: decentral1se <cellarspoon@riseup.net> Reviewed-on: coop-cloud/abra#403 Co-authored-by: p4u1 <p4u1_f4u1@riseup.net> Co-committed-by: p4u1 <p4u1_f4u1@riseup.net>
This commit is contained in:
		| @ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| ABRA_VERSION="0.8.1-beta" | ABRA_VERSION="0.8.1-beta" | ||||||
| ABRA_RELEASE_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$ABRA_VERSION" | ABRA_RELEASE_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$ABRA_VERSION" | ||||||
| RC_VERSION="0.8.1-beta" | RC_VERSION="0.8.0-rc1-beta" | ||||||
| RC_VERSION_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$RC_VERSION" | RC_VERSION_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$RC_VERSION" | ||||||
|  |  | ||||||
| for arg in "$@"; do | for arg in "$@"; do | ||||||
|  | |||||||
| @ -70,13 +70,13 @@ setup(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA app check "$TEST_APP_DOMAIN" |   run $ABRA app check "$TEST_APP_DOMAIN" | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   refute_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   _reset_recipe |   _reset_recipe | ||||||
| } | } | ||||||
| @ -86,7 +86,7 @@ setup(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 1' |   assert_output --partial "Your branch is behind 'origin/main' by 1 commit" | ||||||
|  |  | ||||||
|   # NOTE(d1): we can't quite tell if this will fail or not in the future, so, |   # NOTE(d1): we can't quite tell if this will fail or not in the future, so, | ||||||
|   # since it isn't an important part of what we're testing here, we don't check |   # since it isn't an important part of what we're testing here, we don't check | ||||||
| @ -94,7 +94,7 @@ setup(){ | |||||||
|   run $ABRA app check "$TEST_APP_DOMAIN" --offline |   run $ABRA app check "$TEST_APP_DOMAIN" --offline | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 1' |   assert_output --partial "Your branch is behind 'origin/main' by 1 commit" | ||||||
|  |  | ||||||
|   _reset_recipe |   _reset_recipe | ||||||
| } | } | ||||||
|  | |||||||
| @ -58,7 +58,7 @@ test_cmd_export" | |||||||
|   assert_success |   assert_success | ||||||
|   assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE" |   assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE" | ||||||
|  |  | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" test_cmd --local |   run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial 'baz' |   assert_output --partial 'baz' | ||||||
|  |  | ||||||
| @ -70,7 +70,7 @@ test_cmd_export" | |||||||
|   assert_success |   assert_success | ||||||
|   assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" |   assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" | ||||||
|  |  | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" test_cmd --local |   run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd | ||||||
|   assert_failure |   assert_failure | ||||||
|   assert_output --partial 'locally unstaged changes' |   assert_output --partial 'locally unstaged changes' | ||||||
|  |  | ||||||
| @ -83,7 +83,7 @@ test_cmd_export" | |||||||
|   assert_success |   assert_success | ||||||
|   assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" |   assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" | ||||||
|  |  | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" test_cmd --local --chaos |   run $ABRA app cmd --local --chaos "$TEST_APP_DOMAIN" test_cmd | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial 'baz' |   assert_output --partial 'baz' | ||||||
|  |  | ||||||
| @ -96,14 +96,14 @@ test_cmd_export" | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" test_cmd --local |   run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial 'baz' |   assert_output --partial 'baz' | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   refute_output --partial 'behind 3' |   assert_output --partial "up to date" | ||||||
|  |  | ||||||
|   _reset_recipe "$TEST_RECIPE" |   _reset_recipe "$TEST_RECIPE" | ||||||
| } | } | ||||||
| @ -113,14 +113,14 @@ test_cmd_export" | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" test_cmd --local --offline |   run $ABRA app cmd --local --offline "$TEST_APP_DOMAIN" test_cmd | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial 'baz' |   assert_output --partial 'baz' | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   _reset_recipe "$TEST_RECIPE" |   _reset_recipe "$TEST_RECIPE" | ||||||
| } | } | ||||||
| @ -132,13 +132,13 @@ test_cmd_export" | |||||||
| } | } | ||||||
|  |  | ||||||
| @test "error if missing arguments when passing --local" { | @test "error if missing arguments when passing --local" { | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" --local |   run $ABRA app cmd --local "$TEST_APP_DOMAIN" | ||||||
|   assert_failure |   assert_failure | ||||||
|   assert_output --partial 'missing arguments' |   assert_output --partial 'missing arguments' | ||||||
| } | } | ||||||
|  |  | ||||||
| @test "cannot use --local and --user at same time" { | @test "cannot use --local and --user at same time" { | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" test_cmd --local --user root |   run $ABRA app cmd --local --user root "$TEST_APP_DOMAIN" test_cmd | ||||||
|   assert_failure |   assert_failure | ||||||
|   assert_output --partial 'cannot use --local & --user together' |   assert_output --partial 'cannot use --local & --user together' | ||||||
| } | } | ||||||
| @ -147,7 +147,7 @@ test_cmd_export" | |||||||
|   run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/abra.sh" |   run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/abra.sh" | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" test_cmd --local --chaos |   run $ABRA app cmd --local --chaos "$TEST_APP_DOMAIN" test_cmd | ||||||
|   assert_failure |   assert_failure | ||||||
|   assert_output --partial "$ABRA_DIR/recipes/$TEST_RECIPE/abra.sh does not exist" |   assert_output --partial "$ABRA_DIR/recipes/$TEST_RECIPE/abra.sh does not exist" | ||||||
|  |  | ||||||
| @ -155,25 +155,25 @@ test_cmd_export" | |||||||
| } | } | ||||||
|  |  | ||||||
| @test "error if missing command" { | @test "error if missing command" { | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" doesnt_exist --local |   run $ABRA app cmd --local "$TEST_APP_DOMAIN" doesnt_exist | ||||||
|   assert_failure |   assert_failure | ||||||
|   assert_output --partial "doesn't have a doesnt_exist function" |   assert_output --partial "doesn't have a doesnt_exist function" | ||||||
| } | } | ||||||
|  |  | ||||||
| @test "run --local command" { | @test "run --local command" { | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" test_cmd --local |   run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial 'baz' |   assert_output --partial 'baz' | ||||||
| } | } | ||||||
|  |  | ||||||
| @test "run command with single arg" { | @test "run command with single arg" { | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" test_cmd_arg --local -- bing |   run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd_arg -- bing | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial 'bing' |   assert_output --partial 'bing' | ||||||
| } | } | ||||||
|  |  | ||||||
| @test "run command with several args" { | @test "run command with several args" { | ||||||
|   run $ABRA app cmd "$TEST_APP_DOMAIN" test_cmd_args --local -- bong bang |   run $ABRA app cmd --local "$TEST_APP_DOMAIN" test_cmd_args -- bong bang | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial 'bong bang' |   assert_output --partial 'bong bang' | ||||||
| } | } | ||||||
|  | |||||||
| @ -16,6 +16,7 @@ teardown_file(){ | |||||||
| setup(){ | setup(){ | ||||||
|   load "$PWD/tests/integration/helpers/common" |   load "$PWD/tests/integration/helpers/common" | ||||||
|   _common_setup |   _common_setup | ||||||
|  |   _reset_recipe | ||||||
| } | } | ||||||
|  |  | ||||||
| teardown(){ | teardown(){ | ||||||
| @ -82,13 +83,13 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA app deploy "$TEST_APP_DOMAIN" --no-input --no-converge-checks |   run $ABRA app deploy "$TEST_APP_DOMAIN" --no-input --no-converge-checks | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   refute_output --partial 'behind 3' |   refute_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   _reset_recipe |   _reset_recipe | ||||||
|   _undeploy_app |   _undeploy_app | ||||||
| @ -100,7 +101,7 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   # NOTE(d1): need to use --chaos to force same commit |   # NOTE(d1): need to use --chaos to force same commit | ||||||
|   run $ABRA app deploy "$TEST_APP_DOMAIN" \ |   run $ABRA app deploy "$TEST_APP_DOMAIN" \ | ||||||
| @ -108,7 +109,7 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   _undeploy_app |   _undeploy_app | ||||||
|   _reset_recipe |   _reset_recipe | ||||||
| @ -116,6 +117,9 @@ teardown(){ | |||||||
|  |  | ||||||
| # bats test_tags=slow | # bats test_tags=slow | ||||||
| @test "deploy latest commit if no published versions and no --chaos" { | @test "deploy latest commit if no published versions and no --chaos" { | ||||||
|  |   # TODO(d1): fix with a new test recipe which has no published versions? | ||||||
|  |   skip "known issue, abra-test-recipe has published versions now" | ||||||
|  |  | ||||||
|   latestCommit="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)" |   latestCommit="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)" | ||||||
|  |  | ||||||
|   _remove_tags |   _remove_tags | ||||||
| @ -140,7 +144,7 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   threeCommitsBack="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)" |   threeCommitsBack="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)" | ||||||
|  |  | ||||||
| @ -273,6 +277,10 @@ teardown(){ | |||||||
| } | } | ||||||
|  |  | ||||||
| @test "ensure domain is checked" { | @test "ensure domain is checked" { | ||||||
|  |   if [[ "$TEST_SERVER" == "default" ]]; then | ||||||
|  |       skip "domain checks are disabled for local server" | ||||||
|  |   fi | ||||||
|  |  | ||||||
|   appDomain="custom-html.DOESNTEXIST" |   appDomain="custom-html.DOESNTEXIST" | ||||||
|  |  | ||||||
|   run $ABRA app new custom-html \ |   run $ABRA app new custom-html \ | ||||||
|  | |||||||
| @ -45,7 +45,7 @@ teardown(){ | |||||||
|   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial "Your branch is up to date with 'origin/main'." |   assert_output --partial "up to date" | ||||||
| } | } | ||||||
|  |  | ||||||
| @test "create new app with version" { | @test "create new app with version" { | ||||||
| @ -121,7 +121,7 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial "Your branch is behind 'origin/main' by 3 commits, and can be fast-forwarded." |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA app new "$TEST_RECIPE" \ |   run $ABRA app new "$TEST_RECIPE" \ | ||||||
|     --no-input \ |     --no-input \ | ||||||
| @ -131,7 +131,7 @@ teardown(){ | |||||||
|   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial "Your branch is up to date with 'origin/main'." |   assert_output --partial "up to date" | ||||||
|  |  | ||||||
|   _reset_recipe |   _reset_recipe | ||||||
| } | } | ||||||
| @ -141,7 +141,7 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial "Your branch is behind 'origin/main' by 3 commits, and can be fast-forwarded." |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   # NOTE(d1): need to use --chaos to force same commit |   # NOTE(d1): need to use --chaos to force same commit | ||||||
|   run $ABRA app new "$TEST_RECIPE" \ |   run $ABRA app new "$TEST_RECIPE" \ | ||||||
| @ -154,7 +154,7 @@ teardown(){ | |||||||
|   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial "Your branch is behind 'origin/main' by 3 commits, and can be fast-forwarded." |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   _reset_recipe |   _reset_recipe | ||||||
| } | } | ||||||
|  | |||||||
| @ -104,7 +104,10 @@ teardown(){ | |||||||
|  |  | ||||||
|   _undeploy_app |   _undeploy_app | ||||||
|  |  | ||||||
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" |   # TODO: should wait as long as volume is no longer in use | ||||||
|  |   sleep 10 | ||||||
|  |  | ||||||
|  |   run $ABRA app volume rm "$TEST_APP_DOMAIN" --no-input | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run $ABRA app volume ls "$TEST_APP_DOMAIN" |   run $ABRA app volume ls "$TEST_APP_DOMAIN" | ||||||
|  | |||||||
| @ -109,13 +109,13 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA app restore "$TEST_APP_DOMAIN" app DOESNTEXIST |   run $ABRA app restore "$TEST_APP_DOMAIN" app | ||||||
|   assert_failure |   assert_failure | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   refute_output --partial 'behind 3' |   assert_output --partial "up to date" | ||||||
| } | } | ||||||
|  |  | ||||||
| @test "ensure recipe not up to date if --offline" { | @test "ensure recipe not up to date if --offline" { | ||||||
| @ -126,19 +126,19 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA app restore "$TEST_APP_DOMAIN" app DOESNTEXIST --offline |   run $ABRA app restore "$TEST_APP_DOMAIN" app --offline | ||||||
|   assert_failure |   assert_failure | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$latestCommit" |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$latestCommit" | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   refute_output --partial 'behind 3' |   assert_output --partial "HEAD detached at $latestCommit" | ||||||
| } | } | ||||||
|  |  | ||||||
| @test "error if missing service" { | @test "error if missing service" { | ||||||
|  | |||||||
| @ -50,13 +50,13 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA app rollback "$TEST_APP_DOMAIN" --no-input --no-converge-checks |   run $ABRA app rollback "$TEST_APP_DOMAIN" --no-input --no-converge-checks | ||||||
|   assert_failure |   assert_failure | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   refute_output --partial 'behind 3' |   assert_output --partial "up to date" | ||||||
| } | } | ||||||
|  |  | ||||||
| @test "ensure recipe not up to date if --offline" { | @test "ensure recipe not up to date if --offline" { | ||||||
| @ -67,14 +67,14 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA app rollback "$TEST_APP_DOMAIN" \ |   run $ABRA app rollback "$TEST_APP_DOMAIN" \ | ||||||
|     --no-input --no-converge-checks --offline |     --no-input --no-converge-checks --offline | ||||||
|   assert_failure |   assert_failure | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$latestCommit" |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$latestCommit" | ||||||
|   assert_success |   assert_success | ||||||
| @ -131,7 +131,7 @@ teardown(){ | |||||||
|   latestCommit="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)" |   latestCommit="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)" | ||||||
|  |  | ||||||
|   run $ABRA app deploy "$TEST_APP_DOMAIN" \ |   run $ABRA app deploy "$TEST_APP_DOMAIN" \ | ||||||
|     --no-input --no-converge-checks --chaos |     --no-input --chaos | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial "$latestCommit" |   assert_output --partial "$latestCommit" | ||||||
|   assert_output --partial 'chaos' |   assert_output --partial 'chaos' | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ setup_file(){ | |||||||
|   run $ABRA app new "$TEST_RECIPE" \ |   run $ABRA app new "$TEST_RECIPE" \ | ||||||
|     --no-input \ |     --no-input \ | ||||||
|     --server "$TEST_SERVER" \ |     --server "$TEST_SERVER" \ | ||||||
|     --domain "$TEST_APP_DOMAIN" \ |     --domain "$TEST_APP_DOMAIN" | ||||||
|   assert_success |   assert_success | ||||||
|   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
| } | } | ||||||
| @ -19,13 +19,6 @@ teardown_file(){ | |||||||
|   _reset_recipe |   _reset_recipe | ||||||
| } | } | ||||||
|  |  | ||||||
| teardown(){ |  | ||||||
|   # https://github.com/bats-core/bats-core/issues/383#issuecomment-738628888 |  | ||||||
|   if [[ -z "${BATS_TEST_COMPLETED}" ]]; then |  | ||||||
|     _undeploy_app |  | ||||||
|   fi |  | ||||||
| } |  | ||||||
|  |  | ||||||
| setup(){ | setup(){ | ||||||
|   load "$PWD/tests/integration/helpers/common" |   load "$PWD/tests/integration/helpers/common" | ||||||
|   _common_setup |   _common_setup | ||||||
|  | |||||||
| @ -59,6 +59,8 @@ teardown(){ | |||||||
|  |  | ||||||
| # bats test_tags=slow | # bats test_tags=slow | ||||||
| @test "error if not in catalogue" { | @test "error if not in catalogue" { | ||||||
|  |   skip "known issue, see https://git.coopcloud.tech/coop-cloud/recipes-catalogue-json/issues/6" | ||||||
|  |  | ||||||
|   _deploy_app |   _deploy_app | ||||||
|  |  | ||||||
|   run $ABRA app version "$TEST_APP_DOMAIN" |   run $ABRA app version "$TEST_APP_DOMAIN" | ||||||
| @ -92,7 +94,7 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|  # NOTE(d1): to let the stack come down before nuking volumes |  # NOTE(d1): to let the stack come down before nuking volumes | ||||||
|   sleep 3 |   sleep 5 | ||||||
|  |  | ||||||
|   run $ABRA app volume remove "$appDomain" --no-input |   run $ABRA app volume remove "$appDomain" --no-input | ||||||
|   assert_success |   assert_success | ||||||
|  | |||||||
| @ -79,7 +79,7 @@ teardown(){ | |||||||
|   _undeploy_app |   _undeploy_app | ||||||
|  |  | ||||||
|   # NOTE(d1): to let the stack come down before nuking volumes |   # NOTE(d1): to let the stack come down before nuking volumes | ||||||
|   sleep 5 |   sleep 10 | ||||||
|  |  | ||||||
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" --force |   run $ABRA app volume rm "$TEST_APP_DOMAIN" --force | ||||||
|   assert_success |   assert_success | ||||||
| @ -93,7 +93,7 @@ teardown(){ | |||||||
|   _undeploy_app |   _undeploy_app | ||||||
|  |  | ||||||
|   # NOTE(d1): to let the stack come down before nuking volumes |   # NOTE(d1): to let the stack come down before nuking volumes | ||||||
|   sleep 5 |   sleep 10 | ||||||
|  |  | ||||||
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" --force |   run $ABRA app volume rm "$TEST_APP_DOMAIN" --force | ||||||
|   assert_success |   assert_success | ||||||
|  | |||||||
| @ -49,7 +49,7 @@ _reset_app(){ | |||||||
|   run $ABRA app new "$TEST_RECIPE" \ |   run $ABRA app new "$TEST_RECIPE" \ | ||||||
|     --no-input \ |     --no-input \ | ||||||
|     --server "$TEST_SERVER" \ |     --server "$TEST_SERVER" \ | ||||||
|     --domain "$TEST_APP_DOMAIN" \ |     --domain "$TEST_APP_DOMAIN" | ||||||
|   assert_success |   assert_success | ||||||
|   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
| } | } | ||||||
|  | |||||||
| @ -11,7 +11,11 @@ _add_server() { | |||||||
| } | } | ||||||
|  |  | ||||||
| _rm_server() { | _rm_server() { | ||||||
|   run $ABRA server remove --no-input "$TEST_SERVER" |   if [[ "$TEST_SERVER" == "default" ]]; then | ||||||
|  |       run rm -rf "$ABRA_DIR/servers/default" | ||||||
|  |   else | ||||||
|  |       run $ABRA server remove --no-input "$TEST_SERVER" | ||||||
|  |   fi | ||||||
|   assert_success |   assert_success | ||||||
|   assert_not_exists "$ABRA_DIR/servers/$TEST_SERVER" |   assert_not_exists "$ABRA_DIR/servers/$TEST_SERVER" | ||||||
| } | } | ||||||
|  | |||||||
| @ -66,13 +66,13 @@ setup() { | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA recipe lint "$TEST_RECIPE" |   run $ABRA recipe lint "$TEST_RECIPE" | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   refute_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   _reset_recipe |   _reset_recipe | ||||||
| } | } | ||||||
| @ -82,13 +82,13 @@ setup() { | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA recipe lint "$TEST_RECIPE" --offline |   run $ABRA recipe lint "$TEST_RECIPE" --offline | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   _reset_recipe |   _reset_recipe | ||||||
| } | } | ||||||
|  | |||||||
| @ -61,14 +61,14 @@ setup(){ | |||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   assert_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   run $ABRA recipe upgrade "$TEST_RECIPE" --no-input |   run $ABRA recipe upgrade "$TEST_RECIPE" --no-input | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial 'can upgrade service: app' |   assert_output --partial 'can upgrade service: app' | ||||||
|  |  | ||||||
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|   refute_output --partial 'behind 3' |   assert_output --regexp 'behind .* 3 commits' | ||||||
|  |  | ||||||
|   _reset_recipe |   _reset_recipe | ||||||
| } | } | ||||||
|  | |||||||
| @ -12,6 +12,8 @@ setup() { | |||||||
| } | } | ||||||
|  |  | ||||||
| @test "error if not present in catalogue" { | @test "error if not present in catalogue" { | ||||||
|  |   skip "known issue, see https://git.coopcloud.tech/coop-cloud/recipes-catalogue-json/issues/6" | ||||||
|  |  | ||||||
|   run $ABRA recipe versions "$TEST_RECIPE" |   run $ABRA recipe versions "$TEST_RECIPE" | ||||||
|   assert_failure |   assert_failure | ||||||
|   assert_output --partial "is not published on the catalogue" |   assert_output --partial "is not published on the catalogue" | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user