Skip to content

Commit 07dd3a0

Browse files
authored
chore(make): add e2e test options (#2393)
- Add more config options to the e2e and e2e-local test options; e.g. E2E_TEST_SEED for reproducing test runs - Refactor e2e-local target to extend the e2e target Signed-off-by: Nick Hale <[email protected]>
1 parent 5812e0b commit 07dd3a0

File tree

4 files changed

+18
-22
lines changed

4 files changed

+18
-22
lines changed

.github/workflows/e2e-kind.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ jobs:
2222
run: |
2323
kind create cluster
2424
kind export kubeconfig
25-
- name: Run e2e tests
25+
- name: Run OLM
2626
run: make run-local

.github/workflows/e2e-minikube.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
sudo mv minikube /bin/
2222
- name: Setup minikube
2323
run: minikube config set vm-driver docker
24-
- name: Run e2e tests
24+
- name: Run OLM
2525
run: make run-local

.github/workflows/e2e-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/setup-go@v2
1515
with:
1616
go-version: '~1.16'
17-
- run: make e2e-local NODES=2 JUNIT_DIRECTORY=./artifacts/
17+
- run: make e2e-local E2E_NODES=2 JUNIT_DIRECTORY=./artifacts/
1818
- name: Archive Test Artifacts # test results, failed or not, are always uploaded.
1919
if: ${{ always() }}
2020
uses: actions/upload-artifact@v2

Makefile

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ GINKGO := $(GO) run github.com/onsi/ginkgo/ginkgo
3030
BINDATA := $(GO) run github.com/go-bindata/go-bindata/v3/go-bindata
3131
GIT_COMMIT := $(shell git rev-parse HEAD)
3232

33+
# Phony prerequisite for targets that rely on the go build cache to determine staleness.
3334
.PHONY: build test run clean vendor schema-check \
3435
vendor-update coverage coverage-html e2e \
3536
kubebuilder .FORCE
3637

38+
.PHONY: FORCE
39+
FORCE:
40+
3741
all: test build
3842

3943
test: clean cover.out
@@ -119,29 +123,23 @@ setup-bare: clean e2e.namespace
119123
. ./scripts/package_release.sh 1.0.0 test/e2e/resources test/e2e/e2e-bare-values.yaml
120124
. ./scripts/install_bare.sh $(shell cat ./e2e.namespace) test/e2e/resources
121125

122-
GINKGO_OPTS := -flakeAttempts 3 -randomizeAllSpecs -v --timeout 120m
126+
E2E_NODES ?= 1
127+
E2E_FLAKE_ATTEMPTS ?= 1
128+
E2E_TIMEOUT ?= 90m
129+
E2E_OPTS ?= $(if $(E2E_SEED),-seed '$(E2E_SEED)') $(if $(TEST),-focus '$(TEST)') -flakeAttempts $(E2E_FLAKE_ATTEMPTS) -nodes $(E2E_NODES) -timeout $(E2E_TIMEOUT) -randomizeAllSpecs -v
130+
E2E_INSTALL_NS ?= operator-lifecycle-manager
131+
E2E_TEST_NS ?= operators
123132

124-
# TODO(tflannag): Remove this target entirely and move downstream
125133
e2e:
126-
$(GINKGO) \
127-
./test/e2e \
128-
$(GINKGO_OPTS) \
129-
$< -- \
130-
-namespace=openshift-operators \
131-
-kubeconfig=${KUBECONFIG} \
132-
-olmNamespace=openshift-operator-lifecycle-manager \
133-
-dummyImage=bitnami/nginx:latest
134+
$(GINKGO) $(E2E_OPTS) $(or $(run), ./test/e2e) $< -- -namespace=$(E2E_TEST_NS) -olmNamespace=$(E2E_INSTALL_NS) -dummyImage=bitnami/nginx:latest $(or $(extra_args), -kubeconfig=${KUBECONFIG})
134135

135-
### Start: End To End Tests ###
136136

137-
# Phony prerequisite for targets that rely on the go build cache to determine staleness.
138-
.PHONY: FORCE
139-
FORCE:
140-
141-
# main entry point for running end to end tests. used by .github/workflows/e2e-tests.yml See test/e2e/README.md for details
137+
# See workflows/e2e-tests.yml See test/e2e/README.md for details.
142138
.PHONY: e2e-local
139+
e2e-local: extra_args=-kind.images=../test/e2e-local.image.tar
140+
e2e-local: run=bin/e2e-local.test
143141
e2e-local: bin/e2e-local.test test/e2e-local.image.tar
144-
$(GINKGO) -nodes $(or $(NODES),1) -flakeAttempts 3 -randomizeAllSpecs $(if $(TEST),-focus '$(TEST)') -v -timeout 90m $< -- -namespace=operators -olmNamespace=operator-lifecycle-manager -dummyImage=bitnami/nginx:latest -kind.images=../test/e2e-local.image.tar
142+
e2e-local: e2e
145143

146144
# this target updates the zz_chart.go file with files found in deploy/chart
147145
# this will always fire since it has been marked as phony
@@ -161,8 +159,6 @@ test/e2e-local.image.tar: e2e.Dockerfile bin/wait bin/cpb $(CMDS)
161159
docker build -t quay.io/operator-framework/olm:local -f $< bin
162160
docker save -o $@ quay.io/operator-framework/olm:local
163161

164-
### Finish: End To End Tests ###
165-
166162
e2e-bare: setup-bare
167163
. ./scripts/run_e2e_bare.sh $(TEST)
168164

0 commit comments

Comments
 (0)