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/docs/schema/config-schema.json b/docs/schema/config-schema.json index 67dcb6b..a3a27e5 100644 --- a/docs/schema/config-schema.json +++ b/docs/schema/config-schema.json @@ -403,16 +403,20 @@ { "type": "object", "required": [ - "mount_path", - "role", "type" ], "properties": { "mount_path": { - "type": "string" + "type": [ + "string", + "null" + ] }, "role": { - "type": "string" + "type": [ + "string", + "null" + ] }, "type": { "type": "string", @@ -425,16 +429,20 @@ { "type": "object", "required": [ - "mount_path", - "role_id", "type" ], "properties": { "mount_path": { - "type": "string" + "type": [ + "string", + "null" + ] }, "role_id": { - "type": "string" + "type": [ + "string", + "null" + ] }, "secret_id_path": { "type": [ @@ -453,16 +461,20 @@ { "type": "object", "required": [ - "mount_path", - "role", "type" ], "properties": { "mount_path": { - "type": "string" + "type": [ + "string", + "null" + ] }, "role": { - "type": "string" + "type": [ + "string", + "null" + ] }, "token_path": { "type": [ @@ -580,15 +592,6 @@ "null" ] }, - "timeout": { - "description": "Vault client timeout in seconds. Default to 60s.", - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, "auth": { "description": "Vault authentication to use when a token is not provided", "anyOf": [ @@ -600,6 +603,15 @@ } ] }, + "timeout": { + "description": "Vault client timeout in seconds. Default to 60s.", + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, "token": { "description": "Vault token as plain string\n\nUse for testing only. DO NOT COMMIT NOVOPS CONFIG WITH THIS SET.", "type": [ 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