test(ws): add safety prompt for E2E test execution (#28)

* test(ws): add safety prompt for E2E test execution

Signed-off-by: Adem Baccara <71262172+Adembc@users.noreply.github.com>

* mathew updates 1

Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>

---------

Signed-off-by: Adem Baccara <71262172+Adembc@users.noreply.github.com>
Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
Co-authored-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
This commit is contained in:
Adem Baccara 2024-08-05 17:42:39 +01:00 committed by GitHub
parent 574ed81e65
commit 50fda656e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 23 additions and 1 deletions

View File

@ -66,8 +66,8 @@ test: manifests generate fmt vet envtest ## Run tests.
# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
.PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
test-e2e:
@$(prompt_for_e2e_test_execution)
go test ./test/e2e/ -v -ginkgo.v
.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter & yamllint
$(GOLANGCI_LINT) run
@ -196,3 +196,25 @@ GOBIN=$(LOCALBIN) go install $${package} ;\
mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\
}
endef
define prompt_for_e2e_test_execution
if [ "$$(echo "$(KUBEFLOW_TEST_PROMPT)" | tr '[:upper:]' '[:lower:]')" = "false" ]; then \
echo "Skipping E2E test confirmation prompt (KUBEFLOW_TEST_PROMPT is set to true)"; \
else \
current_k8s_context=$$(kubectl config current-context); \
echo "================================ WARNING ================================"; \
echo "E2E tests use your current Kubernetes context!"; \
echo "This will DELETE EXISTING RESOURCES such as cert-manager!"; \
echo "Current context: '$$current_k8s_context'"; \
echo "========================================================================="; \
echo "Proceed with E2E tests? (yes/NO)"; \
read user_confirmation; \
case $$user_confirmation in \
[yY] | [yY][eE][sS] ) \
echo "Running E2E tests...";; \
[nN] | [nN][oO] | * ) \
echo "Aborting E2E tests..."; \
exit 1; \
esac \
fi
endef