From 687feea193c1b583a385994e8e67a9c8a892c554 Mon Sep 17 00:00:00 2001 From: Federico Paolinelli Date: Mon, 19 Jun 2023 16:21:52 +0200 Subject: [PATCH] Makefile: add a rule to run e2e tests We add a rule to fetch ginkgo, and another one to run the e2e tests. Signed-off-by: Federico Paolinelli --- Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Makefile b/Makefile index e4d44697..55c0e3d9 100644 --- a/Makefile +++ b/Makefile @@ -115,6 +115,7 @@ KIND ?= $(LOCALBIN)/kind KUBECTL ?= $(LOCALBIN)/kubectl KUSTOMIZE ?= $(LOCALBIN)/kustomize CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen +GINKGO ?= $(LOCALBIN)/ginkgo ENVTEST ?= $(LOCALBIN)/setup-envtest KUBECONFIG_PATH ?= $(LOCALBIN)/kubeconfig export KUBECONFIG=$(KUBECONFIG_PATH) @@ -123,6 +124,7 @@ export KUBECONFIG=$(KUBECONFIG_PATH) KUSTOMIZE_VERSION ?= v5.0.0 CONTROLLER_TOOLS_VERSION ?= v0.11.3 KUBECTL_VERSION ?= v1.27.0 +GINKGO_VERSION ?= v2.11.0 KIND_VERSION ?= v0.19.0 KIND_CLUSTER_NAME ?= frr-k8s @@ -179,6 +181,17 @@ envtest: $(ENVTEST) ## Download envtest-setup locally if necessary. $(ENVTEST): $(LOCALBIN) test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest +.PHONY: ginkgo +ginkgo: $(GINKGO) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten. +$(GINKGO): $(LOCALBIN) + test -s $(LOCALBIN)/ginkgo && $(LOCALBIN)/ginkgo version | grep -q $(GINKGO_VERSION) || \ + GOBIN=$(LOCALBIN) go install github.com/onsi/ginkgo/v2/ginkgo@$(GINKGO_VERSION) + +.PHONY: e2etest +e2etest: ginkgo + $(GINKGO) -v $(GINKGO_ARGS) ./e2etests + + .PHONY: kind-cluster kind-cluster: kind KIND_BIN=$(LOCALBIN)/kind hack/kind.sh