61 lines
1.2 KiB
Bash
61 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
setup_file(){
|
|
load "$PWD/tests/integration/helpers/common"
|
|
_common_setup
|
|
_add_server
|
|
_new_app
|
|
}
|
|
|
|
teardown_file(){
|
|
_rm_app
|
|
_rm_server
|
|
}
|
|
|
|
setup(){
|
|
load "$PWD/tests/integration/helpers/common"
|
|
_common_setup
|
|
}
|
|
|
|
teardown(){
|
|
# https://github.com/bats-core/bats-core/issues/383#issuecomment-738628888
|
|
if [[ -z "${BATS_TEST_COMPLETED}" ]]; then
|
|
_undeploy_app
|
|
fi
|
|
}
|
|
|
|
@test "validate app argument" {
|
|
run $ABRA app restart
|
|
assert_failure
|
|
assert_output --partial 'no app provided'
|
|
|
|
run $ABRA app restart DOESNTEXIST
|
|
assert_failure
|
|
assert_output --partial 'cannot find app'
|
|
}
|
|
|
|
@test "error if service missing" {
|
|
run $ABRA app restart "$TEST_APP_DOMAIN"
|
|
assert_failure
|
|
assert_output --partial 'missing service'
|
|
}
|
|
|
|
@test "error if not deployed" {
|
|
run $ABRA app restart "$TEST_APP_DOMAIN" app
|
|
assert_failure
|
|
assert_output --partial 'is not deployed'
|
|
}
|
|
|
|
# bats test_tags=slow
|
|
@test "app is restarted" {
|
|
_deploy_app
|
|
|
|
run $ABRA app restart "$TEST_APP_DOMAIN" app --debug
|
|
assert_success
|
|
assert_output --regexp 'attempting to scale .* to 0'
|
|
assert_output --regexp 'attempting to scale .* to 1'
|
|
assert_output --partial 'service successfully restarted'
|
|
|
|
_undeploy_app
|
|
}
|