From 1a6112769c2ad9731042db9d3cb2eaf7dd4f8f46 Mon Sep 17 00:00:00 2001 From: Andre Fernandes Date: Fri, 27 Aug 2021 09:41:37 -0300 Subject: [PATCH] common setup and custom log --- vkpr-test/common-setup.bash | 10 +++++++--- vkpr-test/ingress-test.bats | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/vkpr-test/common-setup.bash b/vkpr-test/common-setup.bash index 3b8162ba..81cffba0 100644 --- a/vkpr-test/common-setup.bash +++ b/vkpr-test/common-setup.bash @@ -2,9 +2,13 @@ _common_setup() { if [ "$VKPR_TEST_SKIP_SETUP" == "true" ]; then - echo "skipping common-setup due to VKPR_TEST_SKIP_SETUP=true" + echo "common_setup: skipping common-setup due to VKPR_TEST_SKIP_SETUP=true" >&3 else - echo "running cluster and installing ingress...." - rit vkpr infra up + if [ "$(k3d cluster list --no-headers | grep 'vkpr-local' | awk '{print $1}')" == "vkpr-local" ]; then + echo "common_setup: vkpr cluster already created, skipping...." >&3 + else + echo "common_setup: running vkpr cluster...." >&3 + rit vkpr infra up + fi fi } diff --git a/vkpr-test/ingress-test.bats b/vkpr-test/ingress-test.bats index 56719192..cdbe517f 100644 --- a/vkpr-test/ingress-test.bats +++ b/vkpr-test/ingress-test.bats @@ -5,9 +5,9 @@ setup_file() { load 'common-setup' _common_setup if [ "$VKPR_TEST_SKIP_SETUP" == "true" ]; then - echo "skipping setup due to VKPR_TEST_SKIP_SETUP=true" + echo "setup: skipping setup due to VKPR_TEST_SKIP_SETUP=true" >&3 else - echo "installing ingress...." + echo "setup: installing ingress...." >&3 rit vkpr ingress install kubectl wait --for=condition=ready --timeout=1m pod --all sleep 2 @@ -44,9 +44,9 @@ setup() { teardown_file() { if [ "$VKPR_TEST_SKIP_TEARDOWN" == "true" ]; then - echo "skipping teardown due to VKPR_TEST_SKIP_TEARDOWN=true" + echo "teardown: skipping teardown due to VKPR_TEST_SKIP_TEARDOWN=true" >&3 else - echo "uninstalling ingress...." + echo "teardown: uninstalling ingress...." >&3 rit vkpr ingress remove rit vkpr infra down fi