Skip to content

Commit

Permalink
chore: use prepare and teardown test script
Browse files Browse the repository at this point in the history
also support container engine podman/ docker
  • Loading branch information
PierreBeucher committed May 27, 2024
1 parent 2a53178 commit 41704ae
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 16 additions & 0 deletions tests/scripts/test-docker-prepare.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions tests/scripts/test-docker-teardown.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 41704ae

Please sign in to comment.