100 lines
1.9 KiB
Bash
100 lines
1.9 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 "ls validate app argument" {
|
|
run $ABRA app volume ls
|
|
assert_failure
|
|
assert_output --partial 'no app provided'
|
|
|
|
run $ABRA app volume ls DOESNTEXIST
|
|
assert_failure
|
|
assert_output --partial 'cannot find app'
|
|
}
|
|
|
|
@test "list no volumes" {
|
|
run $ABRA app volume ls "$TEST_APP_DOMAIN"
|
|
assert_success
|
|
assert_output --partial 'no volumes created'
|
|
}
|
|
|
|
# bats test_tags=slow
|
|
@test "list volumes" {
|
|
_deploy_app
|
|
|
|
run $ABRA app volume ls "$TEST_APP_DOMAIN"
|
|
assert_success
|
|
assert_output --partial 'test-volume'
|
|
|
|
_undeploy_app
|
|
}
|
|
|
|
@test "rm validate app argument" {
|
|
run $ABRA app volume rm
|
|
assert_failure
|
|
assert_output --partial 'no app provided'
|
|
|
|
run $ABRA app volume rm DOESNTEXIST
|
|
assert_failure
|
|
assert_output --partial 'cannot find app'
|
|
}
|
|
|
|
# bats test_tags=slow
|
|
@test "rm error if deployed" {
|
|
_deploy_app
|
|
|
|
run $ABRA app volume rm "$TEST_APP_DOMAIN" --force
|
|
assert_failure
|
|
assert_output --partial 'is still deployed'
|
|
|
|
_undeploy_app
|
|
}
|
|
|
|
# bats test_tags=slow
|
|
@test "remove volumes" {
|
|
_deploy_app
|
|
|
|
_undeploy_app
|
|
|
|
run $ABRA app volume rm "$TEST_APP_DOMAIN" --force
|
|
assert_success
|
|
assert_output --partial 'volumes removed successfully'
|
|
}
|
|
|
|
# bats test_tags=slow
|
|
@test "remove no volumes" {
|
|
_deploy_app
|
|
|
|
_undeploy_app
|
|
|
|
run $ABRA app volume rm "$TEST_APP_DOMAIN" --force
|
|
assert_success
|
|
assert_output --partial 'volumes removed successfully'
|
|
|
|
run $ABRA app volume rm "$TEST_APP_DOMAIN" --force
|
|
assert_success
|
|
assert_output --partial 'no volumes removed'
|
|
}
|