diff --git a/Makefile b/Makefile index 3c4f554..d274784 100644 --- a/Makefile +++ b/Makefile @@ -14,14 +14,15 @@ build-nix: nix build -o build/nix .PHONY: test -test: test-docker test-doc test-clippy test-cargo test-cli test-install - -.PHONY: test-docker -test-docker: - podman-compose -f tests/docker-compose.yml up -d - kind delete cluster -n novops-auth-test - kind create cluster -n novops-auth-test - docker network connect tests_default novops-auth-test-control-plane +test: test-prepare test-doc test-clippy test-cargo test-cli test-install test-teardown + +.PHONY: test-prepare +test-prepare: + tests/scripts/test-docker-prepare.sh + +.PHONY: test-teardown +test-teardown: + tests/scripts/test-docker-teardown.sh .PHONY: test-cargo test-cargo: diff --git a/tests/scripts/test-docker-prepare.sh b/tests/scripts/test-docker-prepare.sh new file mode 100755 index 0000000..28d04e8 --- /dev/null +++ b/tests/scripts/test-docker-prepare.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e + +CONTAINER_CLI=${CONTAINER_CLI:-docker} + +export KIND_EXPERIMENTAL_PROVIDER=$CONTAINER_CLI + +$CONTAINER_CLI compose -f tests/docker-compose.yml up -d + +if ! kind get clusters | grep -q 'novops-auth-test'; then + kind create cluster -n novops-auth-test + $CONTAINER_CLI network connect tests_default novops-auth-test-control-plane +else + echo "Kind cluster already exists" +fi \ No newline at end of file diff --git a/tests/scripts/test-docker-teardown.sh b/tests/scripts/test-docker-teardown.sh new file mode 100755 index 0000000..1cfa7c4 --- /dev/null +++ b/tests/scripts/test-docker-teardown.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -e + +CONTAINER_CLI=${CONTAINER_CLI:-docker} + + +export KIND_EXPERIMENTAL_PROVIDER=$CONTAINER_CLI +kind delete cluster -n novops-auth-test + +$CONTAINER_CLI compose -f tests/docker-compose.yml down -v \ No newline at end of file