Skip to content

Commit 50fda65

Browse files
test(ws): add safety prompt for E2E test execution (#28)
* test(ws): add safety prompt for E2E test execution Signed-off-by: Adem Baccara <[email protected]> * mathew updates 1 Signed-off-by: Mathew Wicks <[email protected]> --------- Signed-off-by: Adem Baccara <[email protected]> Signed-off-by: Mathew Wicks <[email protected]> Co-authored-by: Mathew Wicks <[email protected]>
1 parent 574ed81 commit 50fda65

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

workspaces/controller/Makefile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ test: manifests generate fmt vet envtest ## Run tests.
6666
# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
6767
.PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
6868
test-e2e:
69+
@$(prompt_for_e2e_test_execution)
6970
go test ./test/e2e/ -v -ginkgo.v
70-
7171
.PHONY: lint
7272
lint: golangci-lint ## Run golangci-lint linter & yamllint
7373
$(GOLANGCI_LINT) run
@@ -196,3 +196,25 @@ GOBIN=$(LOCALBIN) go install $${package} ;\
196196
mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\
197197
}
198198
endef
199+
200+
define prompt_for_e2e_test_execution
201+
if [ "$$(echo "$(KUBEFLOW_TEST_PROMPT)" | tr '[:upper:]' '[:lower:]')" = "false" ]; then \
202+
echo "Skipping E2E test confirmation prompt (KUBEFLOW_TEST_PROMPT is set to true)"; \
203+
else \
204+
current_k8s_context=$$(kubectl config current-context); \
205+
echo "================================ WARNING ================================"; \
206+
echo "E2E tests use your current Kubernetes context!"; \
207+
echo "This will DELETE EXISTING RESOURCES such as cert-manager!"; \
208+
echo "Current context: '$$current_k8s_context'"; \
209+
echo "========================================================================="; \
210+
echo "Proceed with E2E tests? (yes/NO)"; \
211+
read user_confirmation; \
212+
case $$user_confirmation in \
213+
[yY] | [yY][eE][sS] ) \
214+
echo "Running E2E tests...";; \
215+
[nN] | [nN][oO] | * ) \
216+
echo "Aborting E2E tests..."; \
217+
exit 1; \
218+
esac \
219+
fi
220+
endef

0 commit comments

Comments
 (0)