abra/tests/02_abra.bats

53 lines
1.5 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bats
setup() {
2020-12-27 19:53:44 +00:00
export ABRA_DIR=$(mktemp -d)
mkdir -p $ABRA_DIR/servers/default
}
teardown() {
2020-12-27 19:53:44 +00:00
rm -rf "$ABRA_DIR"
}
@test "abra server (add|rm)" {
./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
./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
}
@test "abra server init" {
./abra server default init
}
@test "abra app (new|rm)" {
2020-12-30 19:56:52 +00:00
./abra app new --server default --domain traefik.test.com --app-name traefik_test_com traefik
2020-12-31 12:33:34 +00:00
[ -f $ABRA_DIR/servers/default/traefik_test_com.env ]
# interactive prompt
2020-12-30 19:56:52 +00:00
echo "y" | ./abra app traefik_test_com delete
[ ! -f $ABRA_DIR/servers/default/traefik_test_com.env ]
# --force
2020-12-30 19:56:52 +00:00
./abra app new --server default --domain traefik_test_com --app-name traefik_test_com traefik
2020-12-31 12:33:34 +00:00
./abra app traefik_test_com delete --force
2020-12-30 19:56:52 +00:00
[ ! -f $ABRA_DIR/servers/default/traefik_test_com.env ]
}
@test "abra app <domain> secret (insert|generate|rm)" {
2020-12-30 19:56:52 +00:00
./abra app new --server default --domain traefik_test_com --app-name traefik_test_com traefik
2020-12-30 19:56:52 +00:00
./abra app traefik_test_com secret insert foobar v1 "foobar"
# interactive prompt
2020-12-30 19:56:52 +00:00
echo "y" | ./abra app traefik_test_com secret rm foobar
2020-12-30 19:56:52 +00:00
./abra app traefik_test_com secret insert foobar v1 "foobar"
# prompt
2020-12-30 19:56:52 +00:00
./abra app traefik_test_com secret rm foobar --force
}