Skip to content

Commit

Permalink
fixup! Add upgrade E2E
Browse files Browse the repository at this point in the history
Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
  • Loading branch information
m1kola committed Jul 2, 2024
1 parent 9dce1de commit 90c602f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,17 @@ extension-developer-e2e: run image-registry test-ext-dev-e2e kind-clean
run-latest-release:
curl -L -s https://github.com/operator-framework/operator-controller/releases/latest/download/install.sh | bash -s

.PHONY: pre-upgrade-setup
pre-upgrade-setup:
./hack/pre-upgrade-setup.sh

.PHONY: pre-upgrade-setup
post-upgrade-checks:
./hack/post-upgrade-checks.sh

.PHONY: test-upgrade-e2e
test-upgrade-e2e: KIND_CLUSTER_NAME := operator-controller-upgrade-e2e
test-upgrade-e2e: kind-cluster run-latest-release image-registry build-push-e2e-catalog registry-load-bundles docker-build kind-load kind-deploy kind-clean #HELP Run upgrade e2e tests on a local kind cluster
test-upgrade-e2e: kind-cluster run-latest-release image-registry build-push-e2e-catalog registry-load-bundles pre-upgrade-setup docker-build kind-load kind-deploy post-upgrade-checks kind-clean #HELP Run upgrade e2e tests on a local kind cluster

.PHONY: e2e-coverage
e2e-coverage:
Expand Down
10 changes: 10 additions & 0 deletions hack/post-upgrade-checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -euo pipefail

TEST_CATALOG_NAME="test-catalog"
TEST_EXTENSION_NAME="test-package"

kubectl wait --for=condition=Available --timeout=60s -n olmv1-system deployment --all
kubectl wait --for=condition=Unpacked --timeout=60s ClusterCatalog $TEST_CATALOG_NAME
kubectl wait --for=condition=Installed --timeout=60s ClusterExtension $TEST_EXTENSION_NAME
47 changes: 47 additions & 0 deletions hack/pre-upgrade-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

set -euo pipefail

help="pre-upgrade-setup.sh is used to create some basic resources
which will later be used in upgrade testing.
The following environment variables are required for configuring this script:
- \$CATALOG_IMG - the tag for the catalog image that contains the registry+v1 bundle.
"

TEST_CATALOG_NAME="test-catalog"
TEST_EXTENSION_NAME="test-package"

if [[ -z "${CATALOG_IMG}" ]]; then
echo "\$CATALOG_IMG is required to be set"
echo "${help}"
exit 1
fi

kubectl apply -f - << EOF
apiVersion: catalogd.operatorframework.io/v1alpha1
kind: ClusterCatalog
metadata:
name: ${TEST_CATALOG_NAME}
spec:
source:
type: image
image:
ref: ${CATALOG_IMG}
pollInterval: 24h
insecureSkipTLSVerify: true
EOF


kubectl apply -f - << EOF
apiVersion: olm.operatorframework.io/v1alpha1
kind: ClusterExtension
metadata:
name: ${TEST_EXTENSION_NAME}
spec:
installNamespace: default
packageName: prometheus
EOF

kubectl wait --for=condition=Unpacked --timeout=60s ClusterCatalog $TEST_CATALOG_NAME
kubectl wait --for=condition=Installed --timeout=60s ClusterExtension $TEST_EXTENSION_NAME

0 comments on commit 90c602f

Please sign in to comment.