Skip to content

Commit 6a48e21

Browse files
Add makefile test targets for test extension
Signed-off-by: killianmuldoon <[email protected]>
1 parent a86df71 commit 6a48e21

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ TOOLS_DIR := hack/tools
5858
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/$(BIN_DIR))
5959
E2E_FRAMEWORK_DIR := $(TEST_DIR)/framework
6060
CAPD_DIR := $(TEST_DIR)/infrastructure/docker
61+
TEST_EXTENSION_DIR := $(TEST_DIR)/extension
6162
GO_INSTALL := ./scripts/go_install.sh
6263
OBSERVABILITY_DIR := hack/observability
6364

@@ -683,6 +684,20 @@ test-capd-junit: $(SETUP_ENVTEST) $(GOTESTSUM) ## Run unit and integration tests
683684
$(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.infra_docker.xml --raw-command cat $(ARTIFACTS)/junit.infra_docker.stdout
684685
exit $$(cat $(ARTIFACTS)/junit.infra_docker.exitcode)
685686

687+
.PHONY: test-test-extension
688+
test-test-extension: $(SETUP_ENVTEST) ## Run unit and integration tests for the test extension
689+
cd $(TEST_EXTENSION_DIR); KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" go test ./... $(TEST_ARGS)
690+
691+
.PHONY: test-test-extension-verbose
692+
test-test-extension-verbose: ## Run unit and integration tests with verbose flag
693+
$(MAKE) test-test-extension TEST_ARGS="$(TEST_ARGS) -v"
694+
695+
.PHONY: test-test-extension-junit
696+
test-test-extension-junit: $(SETUP_ENVTEST) $(GOTESTSUM) ## Run unit and integration tests and generate a junit report for the test extension
697+
cd $(TEST_EXTENSION_DIR); set +o errexit; (KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" go test -json ./... $(TEST_ARGS); echo $$? > $(ARTIFACTS)/junit.test_extension.exitcode) | tee $(ARTIFACTS)/junit.test_extension.stdout
698+
$(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.test_extension.xml --raw-command cat $(ARTIFACTS)/junit.test_extension.stdout
699+
exit $$(cat $(ARTIFACTS)/junit.test_extension.exitcode)
700+
686701
.PHONY: kind-cluster
687702
kind-cluster: ## Create a new kind cluster designed for development with Tilt
688703
hack/kind-install-for-capd.sh

scripts/ci-test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ make test-junit
3030
echo -e "\n*** Testing Cluster API Provider Docker ***\n"
3131
# Docker provider
3232
make test-capd-junit
33+
34+
echo -e "\n*** Testing Cluster API Runtime SDK test extension ***\n"
35+
# Test Extension
36+
make test-test-extension-junit

0 commit comments

Comments
 (0)