Skip to content

Commit

Permalink
refactor operator-framework-e2e (#503)
Browse files Browse the repository at this point in the history
* 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 <everettraven@gmail.com>

* input validation and decoupling of test and setup.sh

Signed-off-by: Bryce Palmer <everettraven@gmail.com>

---------

Signed-off-by: Bryce Palmer <everettraven@gmail.com>
  • Loading branch information
everettraven authored Nov 2, 2023
1 parent 7411e68 commit e78fd95
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 1,410 deletions.
27 changes: 7 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,13 @@ E2E_FLAGS ?= ""
e2e: $(GINKGO) #EXHELP Run the e2e tests.
$(GINKGO) --tags $(GO_BUILD_TAGS) $(E2E_FLAGS) -trace -progress $(FOCUS) test/e2e

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

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

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

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

.PHONY: deploy-local-registry
deploy-local-registry: #EXHELP Deploy local registry.
$(CONTAINER_RUNTIME) run -d -p 5001:5000 --restart=always --name local-registry registry:2

.PHONY: cleanup-local-registry
cleanup-local-registry: #EXHELP Stop and remove local registry.
$(CONTAINER_RUNTIME) container stop local-registry
$(CONTAINER_RUNTIME) container rm -v local-registry

opm: $(OPM)
$(OPM) $(OPM_ARGS)

operator-sdk: $(OPERATOR_SDK)
(cd $(OPERATOR_SDK_PROJECT_PATH) && $(OPERATOR_SDK) $(OPERATOR_SDK_ARGS))

kustomize: $(KUSTOMIZE)
(cd $(OPERATOR_SDK_PROJECT_PATH) && $(KUSTOMIZE) $(KUSTOMIZE_ARGS))

#SECTION Build

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/go-logr/logr v1.3.0
github.com/onsi/ginkgo/v2 v2.13.0
github.com/onsi/gomega v1.29.0
github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42
github.com/operator-framework/catalogd v0.7.0
github.com/operator-framework/deppy v0.0.1
github.com/operator-framework/operator-registry v1.28.0
Expand All @@ -19,7 +18,6 @@ require (
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.26.1
k8s.io/apiextensions-apiserver v0.26.1
k8s.io/apimachinery v0.26.1
k8s.io/client-go v0.26.1
k8s.io/component-base v0.26.1
Expand Down Expand Up @@ -99,6 +97,7 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42 // indirect
github.com/otiai10/copy v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand Down Expand Up @@ -137,6 +136,7 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.26.1 // indirect
k8s.io/apiserver v0.26.1 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
Expand Down
202 changes: 0 additions & 202 deletions test/operator-framework-e2e/README.md

This file was deleted.

Loading

0 comments on commit e78fd95

Please sign in to comment.