test: update and fix cleanup for "server add"
This commit is contained in:
parent
1fe601cd16
commit
712ebfb701
@ -1,8 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
setup_file(){
|
||||
load "$PWD/tests/integration/helpers/common"
|
||||
_common_setup
|
||||
|
||||
run docker swarm leave --force
|
||||
}
|
||||
|
||||
setup(){
|
||||
load "$PWD/tests/integration/helpers/common"
|
||||
_common_setup
|
||||
|
||||
run docker swarm init
|
||||
assert_success
|
||||
}
|
||||
|
||||
teardown(){
|
||||
run docker swarm leave --force
|
||||
assert_success
|
||||
|
||||
_rm_server
|
||||
}
|
||||
|
||||
@test "add new server" {
|
||||
@ -16,29 +33,24 @@ setup(){
|
||||
assert bash -c "docker context ls | grep -q $TEST_SERVER"
|
||||
}
|
||||
|
||||
@test "error if using domain and --local together" {
|
||||
@test "error if using name and --local together" {
|
||||
run $ABRA server add "$TEST_SERVER" --local
|
||||
assert_failure
|
||||
assert_output --partial 'cannot use <domain> and --local together'
|
||||
assert_output --partial 'cannot use <name> and --local together'
|
||||
}
|
||||
|
||||
@test "create local server" {
|
||||
run docker swarm init
|
||||
assert_success
|
||||
|
||||
run $ABRA server add --local
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/servers/default"
|
||||
assert bash -c "docker context ls | grep -q default"
|
||||
assert_output --partial 'local server added'
|
||||
|
||||
docker swarm leave --force
|
||||
assert_success
|
||||
|
||||
_rm_default_server
|
||||
assert_output --partial 'local server successfully added'
|
||||
}
|
||||
|
||||
@test "create local server fails when no docker swarm" {
|
||||
run docker swarm leave --force
|
||||
assert_success
|
||||
|
||||
run $ABRA server add --local
|
||||
assert_failure
|
||||
assert_not_exists "$ABRA_DIR/servers/default"
|
||||
|
Loading…
x
Reference in New Issue
Block a user