abra/tests/02_abra.bats
2020-12-27 21:53:44 +02:00

50 lines
1.4 KiB
Bash

#!/usr/bin/env bats
setup() {
export ABRA_DIR=$(mktemp -d)
mkdir -p $ABRA_DIR/servers/default
}
teardown() {
rm -rf "$ABRA_DIR"
}
@test "abra server add/rm works" {
./abra server add swarm.test.com
docker context ls | grep swarm.test.com
[ -d $ABRA_DIR/servers/swarm.test.com ]
./abra server swarm.test.com rm
./abra server add swarm.test.com foobar 12345
[ -d $ABRA_DIR/servers/swarm.test.com ]
./abra server swarm.test.com rm
}
@test "abra app new/rm works" {
./abra app new --server default --domain traefik.test.com traefik
[ -f $ABRA_DIR/servers/default/traefik.test.com.env ]
# interactive prompt
echo "y" | ./abra app traefik.test.com delete
[ ! -f $ABRA_DIR/servers/default/traefik.test.com.env ]
# --force
./abra app new --server default --domain traefik.test.com traefik
./abra app traefik.test.com delete --force
[ ! -f $ABRA_DIR/servers/default/traefik.test.com.env ]
}
@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
}