2020-10-31 15:06:41 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
setup() {
|
2020-12-27 19:53:44 +00:00
|
|
|
export ABRA_DIR=$(mktemp -d)
|
|
|
|
mkdir -p $ABRA_DIR/servers/default
|
2020-10-31 15:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
teardown() {
|
2020-12-27 19:53:44 +00:00
|
|
|
rm -rf "$ABRA_DIR"
|
2020-10-31 15:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "abra server add/rm works" {
|
|
|
|
./abra server add swarm.test.com
|
|
|
|
docker context ls | grep swarm.test.com
|
2020-12-27 19:53:44 +00:00
|
|
|
[ -d $ABRA_DIR/servers/swarm.test.com ]
|
2020-12-27 12:11:22 +00:00
|
|
|
./abra server swarm.test.com rm
|
2020-10-31 15:06:41 +00:00
|
|
|
|
|
|
|
./abra server add swarm.test.com foobar 12345
|
2020-12-27 19:53:44 +00:00
|
|
|
[ -d $ABRA_DIR/servers/swarm.test.com ]
|
2020-12-27 12:11:22 +00:00
|
|
|
./abra server swarm.test.com rm
|
2020-10-31 15:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "abra app new/rm works" {
|
|
|
|
./abra app new --server default --domain traefik.test.com traefik
|
2020-12-27 19:53:44 +00:00
|
|
|
[ -f $ABRA_DIR/servers/default/traefik.test.com.env ]
|
2020-10-31 15:06:41 +00:00
|
|
|
|
|
|
|
# interactive prompt
|
|
|
|
echo "y" | ./abra app traefik.test.com delete
|
2020-12-27 19:53:44 +00:00
|
|
|
[ ! -f $ABRA_DIR/servers/default/traefik.test.com.env ]
|
2020-10-31 15:06:41 +00:00
|
|
|
|
|
|
|
# --force
|
|
|
|
./abra app new --server default --domain traefik.test.com traefik
|
|
|
|
./abra app traefik.test.com delete --force
|
2020-12-27 19:53:44 +00:00
|
|
|
[ ! -f $ABRA_DIR/servers/default/traefik.test.com.env ]
|
2020-10-31 15:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "abra app <domain> secret (insert|generate|rm)" {
|
|
|
|
# TODO 3wc: mock `server new` so we don't endlessly re-test it
|
|
|
|
./abra app new --server default --domain traefik.test.com traefik
|
|
|
|
|
|
|
|
./abra app traefik.test.com secret insert foobar v1 "foobar"
|
|
|
|
|
|
|
|
# interactive prompt
|
|
|
|
echo "y" | ./abra app traefik.test.com secret rm foobar
|
|
|
|
|
|
|
|
./abra app traefik.test.com secret insert foobar v1 "foobar"
|
|
|
|
# prompt
|
|
|
|
./abra app traefik.test.com secret rm foobar --force
|
|
|
|
}
|