test: integration test for abra app upgrade [ci skip]

This commit is contained in:
decentral1se 2023-09-21 11:52:35 +02:00
parent aa37c936eb
commit 8f1231e409
Signed by untrusted user: decentral1se
GPG Key ID: 03789458B3D0C410

View File

@ -8,6 +8,7 @@ setup_file(){
}
teardown_file(){
_rm_app
_rm_server
}
@ -25,3 +26,51 @@ setup(){
assert_failure
assert_output --partial 'cannot find app'
}
# bats test_tags=slow
@test "upgrade app" {
latestVersion=$(jq -r '.gitea.versions[-1] | keys[0]' < "$ABRA_DIR/catalogue/recipes.json")
refute [ -z "$latestVersion" ];
rollbackVersion=$(jq -r '.gitea.versions[-2] | keys[0]' < "$ABRA_DIR/catalogue/recipes.json")
refute [ -z "$rollbackVersion" ];
run $ABRA app new gitea \
--no-input \
--server "$TEST_SERVER" \
--domain "gitea.$TEST_SERVER" \
--secrets
assert_success
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/gitea.$TEST_SERVER.env"
run $ABRA app deploy "gitea.$TEST_SERVER" --no-input
assert_success
assert_output --partial "$latestVersion"
run $ABRA app rollback "gitea.$TEST_SERVER" --no-input
assert_success
assert_output --partial "$rollbackVersion"
# NOTE(d1): let runtime settle down before upgrade
sleep 5
run $ABRA app upgrade "gitea.$TEST_SERVER" --no-input
assert_success
assert_output --partial "$latestVersion"
run $ABRA app undeploy "gitea.$TEST_SERVER" --no-input
assert_success
run $ABRA app secret remove "gitea.$TEST_SERVER" --all --no-input
assert_success
# NOTE(d1): to let the stack come down before nuking volumes
sleep 5
run $ABRA app volume remove "gitea.$TEST_SERVER" --no-input
assert_success
run $ABRA app remove "gitea.$TEST_SERVER" --no-input
assert_success
assert_not_exists "$ABRA_DIR/servers/$TEST_SERVER/gitea.$TEST_SERVER.env"
}