@@ -55,18 +55,21 @@ vet: ## Run go vet against code.
55
55
go vet ./...
56
56
57
57
ENVTEST_ASSETS_DIR =$(shell pwd) /testbin
58
- test : manifests generate generate-mocks fmt vet # # Run tests.
58
+ test : manifests generate generate-mocks fmt vet test-setup # # Run tests.
59
+ source ${ENVTEST_ASSETS_DIR} /setup-envtest.sh; setup_envtest_env $(ENVTEST_ASSETS_DIR ) ; go test ./... -coverprofile cover.out -covermode=atomic
60
+
61
+ test-setup : # setup test environment
59
62
mkdir -p ${ENVTEST_ASSETS_DIR}
60
63
test -f ${ENVTEST_ASSETS_DIR} /setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR} /setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.2/hack/setup-envtest.sh
61
- source ${ENVTEST_ASSETS_DIR} /setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR ) ; setup_envtest_env $( ENVTEST_ASSETS_DIR ) ; go test ./... -coverprofile cover.out -covermode=atomic
64
+ source ${ENVTEST_ASSETS_DIR} /setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR )
62
65
63
- integration-setup : # # Setup the integration test using kind clusters
66
+ integration-setup : build kind test-setup # # Setup the integration test using kind clusters
64
67
@./integration/scripts/setup-kind.sh
65
68
66
69
integration-run : # # Run the integration test controller
67
70
@./integration/scripts/run-tests.sh
68
71
69
- integration-cleanup : # # Cleanup integration test resources in Cloud Map and local kind cluster
72
+ integration-cleanup : kind # # Cleanup integration test resources in Cloud Map and local kind cluster
70
73
@./integration/scripts/cleanup-cloudmap.sh
71
74
@./integration/scripts/cleanup-kind.sh
72
75
@@ -126,6 +129,9 @@ MOCKGEN = $(shell pwd)/bin/mockgen
126
129
mockgen : # # Download mockgen
127
130
$(call go-get-tool,$(MOCKGEN ) ,github.com/golang/mock/[email protected] )
128
131
132
+ KIND = $(shell pwd) /bin/kind
133
+ kind : # # Download kind
134
+ $(call go-get-tool,$(KIND ) ,sigs.k8s.io/[email protected] )
129
135
130
136
# go-get-tool will 'go get' any package $2 and install it to $1.
131
137
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST ) ) ) )
0 commit comments