Skip to content

Commit 89d6c8d

Browse files
authored
Setup envtests in CRA (#18240)
1 parent 8ed1677 commit 89d6c8d

File tree

1 file changed

+22
-0
lines changed
  • components/compass-runtime-agent

1 file changed

+22
-0
lines changed

components/compass-runtime-agent/Makefile

+22
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,25 @@ release:
1717
.PHONY: path-to-referenced-charts
1818
path-to-referenced-charts:
1919
@echo "resources/compass-runtime-agent"
20+
21+
.PHONY: test
22+
test: envtest ## Run tests.
23+
if [ -d "$(ARTIFACTS)" ]; then \
24+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -v -coverprofile $(ARTIFACTS)/filtered.cov; \
25+
else \
26+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -v; \
27+
fi
28+
29+
30+
ENVTEST_K8S_VERSION = 1.26.0
31+
32+
LOCALBIN ?= $(shell pwd)/bin
33+
$(LOCALBIN):
34+
mkdir -p $(LOCALBIN)
35+
36+
ENVTEST ?= $(LOCALBIN)/setup-envtest
37+
38+
.PHONY: envtest
39+
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
40+
$(ENVTEST): $(LOCALBIN)
41+
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

0 commit comments

Comments
 (0)