Skip to content

Commit

Permalink
refactor upgrade-e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ankita Thomas <[email protected]>
  • Loading branch information
ankitathomas committed Jul 17, 2024
1 parent 26408bc commit 013151d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,16 @@ lint: $(GOLANGCI_LINT) ## Run golangci linter.

.PHONY: test-upgrade-e2e
test-upgrade-e2e: export TEST_CLUSTER_CATALOG_NAME := test-catalog
test-upgrade-e2e: kind-cluster cert-manager build-container kind-load image-registry run-latest-release wait pre-upgrade-setup deploy ## Run upgrade e2e tests on a local kind cluster
test-upgrade-e2e:
${MAKE} wait
${MAKE} post-upgrade-checks
${MAKE} kind-cluster-cleanup
test-upgrade-e2e: export TEST_CLUSTER_CATALOG_IMAGE := docker-registry.catalogd-e2e.svc:5000/test-catalog:e2e
test-upgrade-e2e: kind-cluster cert-manager build-container kind-load image-registry run-latest-release pre-upgrade-setup deploy wait post-upgrade-checks kind-cluster-cleanup ## Run upgrade e2e tests on a local kind cluster

pre-upgrade-setup:
./test/tools/imageregistry/pre-upgrade-setup.sh
./test/tools/imageregistry/pre-upgrade-setup.sh ${TEST_CLUSTER_CATALOG_IMAGE} ${TEST_CLUSTER_CATALOG_NAME}

.PHONY: run-latest-release
run-latest-release:
kubectl apply -f https://github.com/operator-framework/catalogd/releases/latest/download/catalogd.yaml
kubectl wait --for=condition=Available --namespace=$(CATALOGD_NAMESPACE) deployment/catalogd-controller-manager --timeout=60s

.PHONY: post-upgrade-checks
post-upgrade-checks:
Expand Down
18 changes: 16 additions & 2 deletions test/tools/imageregistry/pre-upgrade-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,22 @@

set -euo pipefail

export TEST_CLUSTER_CATALOG_NAME=${TEST_CLUSTER_CATALOG_NAME:-"test-catalog"}
export TEST_CLUSTER_CATALOG_IMAGE=${TEST_CLUSTER_CATALOG_IMAGE:-"docker-registry.catalogd-e2e.svc:5000/test-catalog:e2e"}

help="pre-upgrade-setup.sh is used to create some basic resources
which will later be used in upgrade testing.
Usage:
pre-upgrade-setup.sh [TEST_CLUSTER_CATALOG_IMAGE] [TEST_CLUSTER_CATALOG_NAME]
"

if [[ "$#" -ne 2 ]]; then
echo "Illegal number of arguments passed"
echo "${help}"
exit 1
fi

export TEST_CLUSTER_CATALOG_IMAGE=$1
export TEST_CLUSTER_CATALOG_NAME=$2

kubectl apply -f - << EOF
apiVersion: catalogd.operatorframework.io/v1alpha1
Expand Down

0 comments on commit 013151d

Please sign in to comment.