From ac054248238c34290d458d32f54a03ca6160fa74 Mon Sep 17 00:00:00 2001 From: Bastian Krol Date: Tue, 21 May 2024 21:22:37 +0200 Subject: [PATCH] refactor: reorganize test roundtrip scripts --- scripts/test-roundtrip.sh | 16 ------- .../bin}/test-cleanup.sh | 3 +- .../bin/test-roundtrip-01-aum-cr-operator.sh | 44 ++++++++++++++++++ .../bin/test-roundtrip-02-aum-operator-cr.sh | 44 ++++++++++++++++++ .../bin/test-roundtrip-03-operator-cr-aum.sh | 46 +++++++++++++++++++ 5 files changed, 136 insertions(+), 17 deletions(-) delete mode 100755 scripts/test-roundtrip.sh rename {scripts => test-resources/bin}/test-cleanup.sh (69%) create mode 100755 test-resources/bin/test-roundtrip-01-aum-cr-operator.sh create mode 100755 test-resources/bin/test-roundtrip-02-aum-operator-cr.sh create mode 100755 test-resources/bin/test-roundtrip-03-operator-cr-aum.sh diff --git a/scripts/test-roundtrip.sh b/scripts/test-roundtrip.sh deleted file mode 100755 index 373c8f3e..00000000 --- a/scripts/test-roundtrip.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -cd "$(dirname ${BASH_SOURCE})"/.. - -echo Make sure cert-manager and collector are deployed as well: -echo test-resources/cert-manager/deploy.sh -echo test-resources/collector/deploy.sh - -scripts/test-cleanup.sh - -make docker-build -test-resources/node.js/express/build-and-deploy.sh -make install -kubectl apply -k config/samples -make deploy diff --git a/scripts/test-cleanup.sh b/test-resources/bin/test-cleanup.sh similarity index 69% rename from scripts/test-cleanup.sh rename to test-resources/bin/test-cleanup.sh index c418d865..0633d024 100755 --- a/scripts/test-cleanup.sh +++ b/test-resources/bin/test-cleanup.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash set -euo pipefail -cd "$(dirname ${BASH_SOURCE})"/.. +cd "$(dirname ${BASH_SOURCE})"/../.. kubectl delete -k config/samples || true make uninstall || true make undeploy || true test-resources/node.js/express/undeploy.sh +test-resources/collector/undeploy.sh diff --git a/test-resources/bin/test-roundtrip-01-aum-cr-operator.sh b/test-resources/bin/test-roundtrip-01-aum-cr-operator.sh new file mode 100755 index 00000000..71fa06fb --- /dev/null +++ b/test-resources/bin/test-roundtrip-01-aum-cr-operator.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname ${BASH_SOURCE})"/../.. + +echo Make sure cert-manager is deployed as well: +echo test-resources/cert-manager/deploy.sh + +echo STEP 1: remove old test resources +test-resources/bin/test-cleanup.sh +echo +echo + +echo STEP 2: deploy the collector +test-resources/collector/deploy.sh +echo +echo + +echo STEP 3: rebuild the operator image +make docker-build +echo +echo + +echo STEP 4: deploy application under monitoring +test-resources/node.js/express/build-and-deploy.sh +echo +echo + +echo STEP 5: install the custom resource definition +make install +echo +echo + +sleep 5 + +echo STEP 6: deploy the Dash0 custom resource to the target namespace +kubectl apply -k config/samples +echo +echo + +sleep 5 + +echo STEP 7: deploy the Dash0 operator +make deploy diff --git a/test-resources/bin/test-roundtrip-02-aum-operator-cr.sh b/test-resources/bin/test-roundtrip-02-aum-operator-cr.sh new file mode 100755 index 00000000..ad115725 --- /dev/null +++ b/test-resources/bin/test-roundtrip-02-aum-operator-cr.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname ${BASH_SOURCE})"/../.. + +echo Make sure cert-manager is deployed as well: +echo test-resources/cert-manager/deploy.sh + +echo STEP 1: remove old test resources +test-resources/bin/test-cleanup.sh +echo +echo + +echo STEP 2: deploy the collector +test-resources/collector/deploy.sh +echo +echo + +echo STEP 3: rebuild the operator image +make docker-build +echo +echo + +echo STEP 4: deploy application under monitoring +test-resources/node.js/express/build-and-deploy.sh +echo +echo + +echo STEP 5: install the custom resource definition +make install +echo +echo + +sleep 5 + +echo STEP 6: deploy the Dash0 operator +make deploy +echo +echo + +sleep 5 + +echo STEP 7: deploy the Dash0 custom resource to the target namespace +kubectl apply -k config/samples diff --git a/test-resources/bin/test-roundtrip-03-operator-cr-aum.sh b/test-resources/bin/test-roundtrip-03-operator-cr-aum.sh new file mode 100755 index 00000000..f6839612 --- /dev/null +++ b/test-resources/bin/test-roundtrip-03-operator-cr-aum.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname ${BASH_SOURCE})"/../.. + +echo Make sure cert-manager is deployed as well: +echo test-resources/cert-manager/deploy.sh + +echo STEP 1: remove old test resources +test-resources/bin/test-cleanup.sh +echo +echo + +echo STEP 2: deploy the collector +test-resources/collector/deploy.sh +echo +echo + +echo STEP 3: rebuild the operator image +make docker-build +echo +echo + +echo STEP 4: install the custom resource definition +make install +echo +echo + +sleep 5 + +echo STEP 5: deploy the Dash0 operator +make deploy +echo +echo + +sleep 5 + +echo STEP 6: deploy the Dash0 custom resource to the target namespace +kubectl apply -k config/samples +echo +echo + +sleep 5 + +echo STEP 7: deploy application under monitoring +test-resources/node.js/express/build-and-deploy.sh