Skip to content

Commit 7d47cd2

Browse files
committed
test: Add E2E_DRYRUN and E2E_VERBOSE make vars
- Use Ginkgo dry-run mode to debug e2e test selection logic - Verbosity is enabled in CI, and dry-run mode
1 parent a51e8db commit 7d47cd2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

make/go.mk

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ bench.%: ## Runs go benchmarks for a specific module
7474
bench.%: ; $(info $(M) running benchmarks$(if $(GOTEST_RUN), matching "$(GOTEST_RUN)") for $* module)
7575
$(if $(filter-out root,$*),cd $* && )go test $(if $(GOTEST_RUN),-run "$(GOTEST_RUN)") -race -cover -v ./...
7676

77-
E2E_PARALLEL_NODES ?= $(shell nproc --ignore=1)
77+
E2E_DRYRUN ?= false
78+
E2E_VERBOSE ?= $(filter $(E2E_DRYRUN)$(CI),true) # If dry-run or CI, enable verbosity
79+
E2E_PARALLEL_NODES ?= $(if $(filter $(E2E_DRYRUN),true),1,$(shell nproc --ignore=1)) # Ginkgo cannot dry-run in parallel
7880
E2E_FLAKE_ATTEMPTS ?= 1
7981
E2E_CONF_FILE ?= $(REPO_ROOT)/test/e2e/config/caren.yaml
8082
E2E_CONF_FILE_ENVSUBST ?= $(basename $(E2E_CONF_FILE))-envsubst.yaml
@@ -88,7 +90,7 @@ e2e-test:
8890
ifneq ($(SKIP_BUILD),true)
8991
$(MAKE) GORELEASER_FLAGS=$$'--config=<(env GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) gojq --yaml-input --yaml-output \'del(.builds[0].goarch) | del(.builds[0].goos) | .builds[0].targets|=(["linux_amd64","linux_arm64",env.GOOS+"_"+env.GOARCH] | unique | map(. | sub("_amd64";"_amd64_v1")))\' .goreleaser.yml)' release-snapshot
9092
endif
91-
$(info $(M) running e2e tests$(if $(E2E_LABEL), labelled "$(E2E_LABEL)")$(if $(E2E_FOCUS), matching "$(E2E_FOCUS)"))
93+
$(info $(M) $(if $(E2E_DRYRUN),dry-,)running e2e tests$(if $(E2E_LABEL), labelled "$(E2E_LABEL)")$(if $(E2E_FOCUS), matching "$(E2E_FOCUS)"))
9294
env E2E_IMAGE_TAG="$$(gojq --raw-output '.version' $(REPO_ROOT)/dist/metadata.json)" \
9395
envsubst -no-unset -no-empty -i '$(E2E_CONF_FILE)' -o '$(E2E_CONF_FILE_ENVSUBST)'
9496
env AWS_B64ENCODED_CREDENTIALS="$$(clusterawsadm bootstrap credentials encode-as-profile 2>/dev/null)" \
@@ -100,11 +102,12 @@ endif
100102
--randomize-suites \
101103
--fail-on-pending \
102104
--keep-going \
103-
$(if $(filter $(CI),true),-v) \
105+
$(if $(filter $(E2E_VERBOSE),true),--vv) \
104106
--covermode=atomic \
105107
--coverprofile coverage-e2e.out \
106-
--procs=$(E2E_PARALLEL_NODES) \
107-
--compilers=$(E2E_PARALLEL_NODES) \
108+
$(if $(filter $(E2E_DRYRUN), true),--dry-run) \
109+
--procs=$(E2E_PARALLEL_NODES) \
110+
--compilers=$(E2E_PARALLEL_NODES) \
108111
--flake-attempts=$(E2E_FLAKE_ATTEMPTS) \
109112
$(if $(E2E_FOCUS),--focus="$(E2E_FOCUS)") \
110113
$(if $(E2E_SKIP),--skip="$(E2E_SKIP)") \

0 commit comments

Comments
 (0)