Skip to content

Commit e3a1f56

Browse files
committed
Move e2e make targets to the main Makefile
1 parent 22fbf01 commit e3a1f56

File tree

2 files changed

+30
-141
lines changed

2 files changed

+30
-141
lines changed

Makefile

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Image URL to use all building/pushing image targets
22
IMG ?= public.ecr.aws/a4z9h2b1/cluster-api-provider-capc:latest
3+
IMG_LOCAL ?= localhost:5000/cluster-api-provider-cloudstack:latest
34

45
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
56
ifeq (,$(shell go env GOBIN))
@@ -43,6 +44,11 @@ all: build
4344
help: ## Display this help.
4445
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
4546

47+
MANIFEST_GEN_INPUTS=$(shell find ./api ./controllers -type f -name "*test*" -prune -o -name "*zz_generated*" -prune -o -print)
48+
49+
# Using a flag file here as config output is too complicated to be a target.
50+
# The following triggers manifest building if $(IMG) differs from that found in config/default/manager_image_patch.yaml.
51+
$(shell grep -qs "$(IMG)" config/default/manager_image_patch_edited.yaml || rm -f config/.flag.mk)
4652
.PHONY: manifests
4753
manifests: config/.flag.mk ## Generates crd, webhook, rbac, and other configuration manifests from kubebuilder instructions in go comments.
4854
config/.flag.mk: bin/controller-gen $(MANIFEST_GEN_INPUTS)
@@ -180,15 +186,36 @@ pkg/mocks/mock%.go: $(shell find ./pkg/cloud -type f -name "*test*" -prune -o -p
180186
##@ Tilt
181187

182188
.PHONY: tilt-up
183-
tilt-up: cluster-api kind-cluster cluster-api/tilt-settings.json manifests cloud-config # Setup and run tilt for development.
189+
tilt-up: cluster-api kind-cluster cluster-api/tilt-settings.json manifests cloud-config ## Setup and run tilt for development.
184190
export CLOUDSTACK_B64ENCODED_SECRET=$$(base64 -w0 -i cloud-config 2>/dev/null || base64 -b 0 -i cloud-config) && cd cluster-api && tilt up
185191

186192
.PHONY: kind-cluster
187-
kind-cluster: cluster-api # Create a kind cluster with a local Docker repository.
193+
kind-cluster: cluster-api ## Create a kind cluster with a local Docker repository.
188194
-./cluster-api/hack/kind-install-for-capd.sh
189195

190-
cluster-api: # Clone cluster-api repository for tilt use.
196+
cluster-api: ## Clone cluster-api repository for tilt use.
191197
git clone --branch v1.0.0 https://github.com/kubernetes-sigs/cluster-api.git
192198

193199
cluster-api/tilt-settings.json: hack/tilt-settings.json cluster-api
194200
cp ./hack/tilt-settings.json cluster-api
201+
202+
##@ End-to-End Testing
203+
204+
CLOUDSTACK_TEMPLATES := $(PROJECT_DIR)/test/e2e/data/infrastructure-cloudstack/v1beta1/
205+
CLUSTER_TEMPLATES_INPUTS=$(shell find $(CLOUDSTACK_TEMPLATES) -type d -name "cluster*")
206+
e2e-cluster-templates: bin/kustomize $(CLOUDSTACK_TEMPLATES)/.templateflag.mk ## Generate cluster template files for e2e testing.
207+
$(CLOUDSTACK_TEMPLATES)/.templateflag.mk: $(CLUSTER_TEMPLATES_INPUTS)
208+
$(shell find $(CLOUDSTACK_TEMPLATES) -type d -name "cluster*" -exec bash -c "bin/kustomize build --load-restrictor LoadRestrictionsNone {} > {}.yaml" \;)
209+
@touch $(CLOUDSTACK_TEMPLATES)/.templateflag.mk
210+
211+
e2e-essentials: bin/ginkgo manifests e2e-cluster-templates kind-cluster ## Fulfill essential tasks for e2e testing.
212+
IMG=$(IMG_LOCAL) make docker-build docker-push
213+
214+
JOB ?= .*
215+
run-e2e: e2e-essentials ## Run e2e testing. JOB is an optional REGEXP to select certainn test cases to run. e.g. JOB=PR-Blocking, JOB=Conformance
216+
cd test/e2e && \
217+
ginkgo -v -trace -tags=e2e -focus=$(JOB) -nodes=1 --noColor=false ./... -- \
218+
-e2e.artifacts-folder=${PROJECT_DIR}/_artifacts \
219+
-e2e.config=${PROJECT_DIR}/test/e2e/config/cloudstack.yaml \
220+
-e2e.skip-resource-cleanup=false -e2e.use-existing-cluster=true
221+
kind delete clusters capi-test

test/e2e/Makefile

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)