abra/tests/integration/server_remove.bats
decentral1se 3c9405a4ed
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
refactor!: --problems/p goes away
Follow up for coop-cloud/abra#413
2024-07-10 13:06:46 +02:00

45 lines
895 B
Bash

#!/usr/bin/env bash
setup_file(){
load "$PWD/tests/integration/helpers/common"
_common_setup
_add_server
}
teardown_file(){
_rm_server
}
setup(){
load "$PWD/tests/integration/helpers/common"
_common_setup
}
teardown(){
_add_server
}
@test "validate server" {
run $ABRA server remove --no-input
assert_failure
assert_output --partial 'no server provided'
run $ABRA server remove foo
assert_failure
assert_output --partial "server doesn't exist"
}
@test "remove server" {
if [ "$TEST_SERVER" = "default" ]; then
skip "cannot delete 'default' server (local)"
fi
assert_exists "$ABRA_DIR/servers/$TEST_SERVER"
assert bash -c "docker context ls | grep -q $TEST_SERVER"
run $ABRA server remove --no-input "$TEST_SERVER"
assert_success
assert_not_exists "$ABRA_DIR/servers/$TEST_SERVER"
refute bash -c "docker context ls | grep -q $TEST_SERVER"
}