Skip to content

Commit e78fd95

Browse files
authored
refactor operator-framework-e2e (#503)
* refactor coast-to-coast e2e to perform setup in a bash script, making it easier to read+modify the setup and easier to read the e2e logic written in Go Signed-off-by: Bryce Palmer <[email protected]> * input validation and decoupling of test and setup.sh Signed-off-by: Bryce Palmer <[email protected]> --------- Signed-off-by: Bryce Palmer <[email protected]>
1 parent 7411e68 commit e78fd95

File tree

8 files changed

+296
-1410
lines changed

8 files changed

+296
-1410
lines changed

Makefile

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,13 @@ E2E_FLAGS ?= ""
108108
e2e: $(GINKGO) #EXHELP Run the e2e tests.
109109
$(GINKGO) --tags $(GO_BUILD_TAGS) $(E2E_FLAGS) -trace -progress $(FOCUS) test/e2e
110110

111+
export REG_PKG_NAME=registry-operator
112+
export PLAIN_PKG_NAME=plain-operator
113+
export CATALOG_IMG=localhost/catalog:e2e
111114
.PHONY: test-op-dev-e2e
112-
test-op-dev-e2e: $(GINKGO) #HELP Run operator create, upgrade and delete tests.
113-
CONTAINER_RUNTIME=$(CONTAINER_RUNTIME) $(GINKGO) --tags $(GO_BUILD_TAGS) $(E2E_FLAGS) -trace -progress $(FOCUS) test/operator-framework-e2e
115+
test-op-dev-e2e: $(GINKGO) $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run operator create, upgrade and delete tests.
116+
test/operator-framework-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) $(KIND) $(KIND_CLUSTER_NAME)
117+
$(GINKGO) --tags $(GO_BUILD_TAGS) -trace -progress $(FOCUS) test/operator-framework-e2e
114118

115119
.PHONY: test-unit
116120
ENVTEST_VERSION = $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.x/')
@@ -126,7 +130,7 @@ test-e2e: run kind-load-test-artifacts e2e e2e-coverage undeploy kind-clean #HEL
126130

127131
.PHONY: operator-developer-e2e
128132
operator-developer-e2e: KIND_CLUSTER_NAME=operator-controller-op-dev-e2e #EXHELP Run operator-developer e2e on local kind cluster
129-
operator-developer-e2e: run $(OPM) $(OPERATOR_SDK) $(KUSTOMIZE) deploy-local-registry test-op-dev-e2e cleanup-local-registry kind-clean
133+
operator-developer-e2e: run test-op-dev-e2e kind-clean
130134

131135
.PHONY: e2e-coverage
132136
e2e-coverage:
@@ -172,23 +176,6 @@ kind-load-test-artifacts: $(KIND) #EXHELP Load the e2e testdata container images
172176
$(KIND) load docker-image localhost/testdata/bundles/plain-v0/plain:v0.1.0 --name $(KIND_CLUSTER_NAME)
173177
$(KIND) load docker-image localhost/testdata/catalogs/test-catalog:e2e --name $(KIND_CLUSTER_NAME)
174178

175-
.PHONY: deploy-local-registry
176-
deploy-local-registry: #EXHELP Deploy local registry.
177-
$(CONTAINER_RUNTIME) run -d -p 5001:5000 --restart=always --name local-registry registry:2
178-
179-
.PHONY: cleanup-local-registry
180-
cleanup-local-registry: #EXHELP Stop and remove local registry.
181-
$(CONTAINER_RUNTIME) container stop local-registry
182-
$(CONTAINER_RUNTIME) container rm -v local-registry
183-
184-
opm: $(OPM)
185-
$(OPM) $(OPM_ARGS)
186-
187-
operator-sdk: $(OPERATOR_SDK)
188-
(cd $(OPERATOR_SDK_PROJECT_PATH) && $(OPERATOR_SDK) $(OPERATOR_SDK_ARGS))
189-
190-
kustomize: $(KUSTOMIZE)
191-
(cd $(OPERATOR_SDK_PROJECT_PATH) && $(KUSTOMIZE) $(KUSTOMIZE_ARGS))
192179

193180
#SECTION Build
194181

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require (
88
github.com/go-logr/logr v1.3.0
99
github.com/onsi/ginkgo/v2 v2.13.0
1010
github.com/onsi/gomega v1.29.0
11-
github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42
1211
github.com/operator-framework/catalogd v0.7.0
1312
github.com/operator-framework/deppy v0.0.1
1413
github.com/operator-framework/operator-registry v1.28.0
@@ -19,7 +18,6 @@ require (
1918
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0
2019
gopkg.in/yaml.v2 v2.4.0
2120
k8s.io/api v0.26.1
22-
k8s.io/apiextensions-apiserver v0.26.1
2321
k8s.io/apimachinery v0.26.1
2422
k8s.io/client-go v0.26.1
2523
k8s.io/component-base v0.26.1
@@ -99,6 +97,7 @@ require (
9997
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
10098
github.com/opencontainers/go-digest v1.0.0 // indirect
10199
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
100+
github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42 // indirect
102101
github.com/otiai10/copy v1.2.0 // indirect
103102
github.com/pkg/errors v0.9.1 // indirect
104103
github.com/pmezard/go-difflib v1.0.0 // indirect
@@ -137,6 +136,7 @@ require (
137136
gopkg.in/inf.v0 v0.9.1 // indirect
138137
gopkg.in/warnings.v0 v0.1.2 // indirect
139138
gopkg.in/yaml.v3 v3.0.1 // indirect
139+
k8s.io/apiextensions-apiserver v0.26.1 // indirect
140140
k8s.io/apiserver v0.26.1 // indirect
141141
k8s.io/klog/v2 v2.80.1 // indirect
142142
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect

test/operator-framework-e2e/README.md

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

0 commit comments

Comments
 (0)