File tree 3 files changed +44
-10
lines changed
3 files changed +44
-10
lines changed Original file line number Diff line number Diff line change @@ -386,13 +386,12 @@ test-e2e-set: ## - Run the blackbox end to end tests without setup.
386
386
# #################################################
387
387
.PHONY : test-cloude2e
388
388
test-cloude2e : prepare-test-context # # - Run cloude2e tests with full setup (slow!)
389
- @make -C ${CLOUD_TESTING_BASE} cloud-deploy
390
- $(eval FLEET_SERVER_URL := $(shell make -C ${CLOUD_TESTING_BASE} cloud-get-fleet-url) )
391
- -@set -o pipefail; $(MAKE ) test-cloude2e-set | tee build/test-cloude2e.out
392
- @make -C ${CLOUD_TESTING_BASE} cloud-clean
389
+ @# Triggered using a shell script to ensure deployment is cleaned up even if errors (using trap).
390
+ @# it would also ensure to exit with failure if any error happens
391
+ @$(CLOUD_TESTING_BASE ) /launch_cloud_e2e_tests.sh
393
392
394
393
.PHONY : test-cloude2e-set
395
394
test-cloude2e-set : # # Run cloude2e test
396
- $(eval FLEET_SERVER_URL := $(shell make -C ${CLOUD_TESTING_BASE} cloud-get-fleet-url) )
395
+ $(eval FLEET_SERVER_URL := $(shell make --no-print-directory - C ${CLOUD_TESTING_BASE} cloud-get-fleet-url) )
397
396
make -C ${CLOUD_TESTING_BASE} cloud-get-fleet-url
398
- FLEET_SERVER_URL=${FLEET_SERVER_URL} go test -v -tags=cloude2e -count=1 -race -p 1 ./testing/cloude2e
397
+ FLEET_SERVER_URL=" ${FLEET_SERVER_URL} " go test -v -tags=cloude2e -count=1 -race -p 1 ./testing/cloude2e
Original file line number Diff line number Diff line change @@ -36,7 +36,5 @@ cloud-clean: ## Clean cloud deployment
36
36
@cd ${TERRAFORM_PATH} ; terraform destroy -auto-approve
37
37
38
38
.PHONY : cloud-get-fleet-url
39
- cloud-get-fleet-url : # # Clean cloud deployment
40
- $(eval FLEET_SERVER_URL := $(shell terraform output --state=${TERRAFORM_PATH}/terraform.tfstate fleet_url) )
41
- @echo ' ${FLEET_SERVER_URL}'
42
-
39
+ cloud-get-fleet-url : # # Get Fleet URL from this deployment
40
+ @terraform output --raw --state=${TERRAFORM_PATH} /terraform.tfstate fleet_url
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ CLOUD_TESTING_BASE=" $( dirname $0 ) "
6
+
7
+ cleanup () {
8
+ r=$?
9
+
10
+ echo " --- Cleaning deployment"
11
+ make -C " ${CLOUD_TESTING_BASE} " cloud-clean
12
+
13
+ exit $r
14
+ }
15
+ trap cleanup EXIT INT TERM
16
+
17
+ echo " --- Creating deployment"
18
+ make -C " ${CLOUD_TESTING_BASE} " cloud-deploy
19
+
20
+ # Ensure Fleet server URL is defined to run the tests
21
+ FLEET_SERVER_URL=$( make --no-print-directory -C " ${CLOUD_TESTING_BASE} " cloud-get-fleet-url)
22
+ echo " Fleet server: \" ${FLEET_SERVER_URL} \" "
23
+ if [[ " ${FLEET_SERVER_URL} " == " " ]]; then
24
+ message=" FLEET_SERVER_URL is empty, cloud e2e tests cannot be executed"
25
+ if [[ " ${CI} " == " true" ]]; then
26
+ buildkite-agent annotate \
27
+ " ${message} " \
28
+ --context " ctx-cloude2e-test" \
29
+ --style " error"
30
+ fi
31
+ echo " ${message} "
32
+ exit 0
33
+ fi
34
+
35
+ echo " --- Trigger cloud E2E test"
36
+ make test-cloude2e-set | tee build/test-cloude2e-set
37
+
You can’t perform that action at this time.
0 commit comments