This repository has been archived on 2021-07-03. You can view files and clone it, but cannot push or open issues or pull requests.
abra/tests/02_abra.bats
3wc 81782bb5f0 make test → test_local, test_docker, test_dind
test_local: run `bats tests/`. Requires `bats`.

test_docker: run docker and install bats in it.

Both of these options require that your local Docker daemon is running
in swarm mode.

test_dind: starts a Docker daemon and runs tests in that. Requires sudo
2020-12-31 22:10:52 +02:00

53 lines
1.5 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)" {
./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 server init" {
./abra server default init
}
@test "abra app (new|rm)" {
./abra app new --server default --domain traefik.test.com --app-name 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 --app-name 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)" {
./abra app new --server default --domain traefik_test_com --app-name 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
}