-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Add upgrade e2e tests #299
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: catalogd-compare | ||
namespace: catalogd-e2e | ||
spec: | ||
containers: | ||
- image: radial/busyboxplus:curl | ||
imagePullPolicy: IfNotPresent | ||
command: ["sh", "-c", "curl -k https://catalogd-catalogserver.olmv1-system.svc.cluster.local/catalogs/test-catalog/all.json | diff build-contents/expected_all.json -"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be good to get rid of hardcoded |
||
name: compare-catalog-contents | ||
volumeMounts: | ||
- mountPath: /build-contents | ||
name: build-contents | ||
readOnly: true | ||
restartPolicy: Never | ||
volumes: | ||
- configMap: | ||
name: catalogd-e2e.build-contents | ||
name: build-contents |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# compare-catalog.sh compares the contents of the clusterCatalog created by registry.sh | ||
# matches the expected contents in testdata/catalogs/test-catalog/expected_all.json. | ||
|
||
# delete any pods persisting from earlier tests | ||
kubectl delete --ignore-not-found --wait -f test/tools/imageregistry/compare-catalog.pod.yaml | ||
kubectl create -f test/tools/imageregistry/compare-catalog.pod.yaml | ||
# wait till pod terminates | ||
kubectl wait -f test/tools/imageregistry/compare-catalog.pod.yaml --for=jsonpath='{.status.containerStatuses[0].state.terminated}' | ||
kubectl logs --all-containers=true -f -n catalogd-e2e catalogd-compare | ||
Comment on lines
+8
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we consider using |
||
if [ "$(kubectl get -f test/tools/imageregistry/compare-catalog.pod.yaml -o jsonpath={.status.containerStatuses[0].state.terminated.exitCode})" -ne 0 ]; then | ||
exit 1 | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
TEST_CATALOG_NAME=${TEST_CATALOG_NAME:-"test-catalog"} | ||
TEST_CATALOG_IMAGE=${TEST_CATALOG_IMAGE:-"docker-registry.catalogd-e2e.svc:5000/test-catalog:e2e"} | ||
|
||
kubectl apply -f - << EOF | ||
apiVersion: catalogd.operatorframework.io/v1alpha1 | ||
kind: ClusterCatalog | ||
metadata: | ||
name: ${TEST_CATALOG_NAME} | ||
spec: | ||
source: | ||
type: image | ||
image: | ||
ref: ${TEST_CATALOG_IMAGE} | ||
insecureSkipTLSVerify: true | ||
EOF | ||
|
||
kubectl wait --for=condition=Unpacked --timeout=60s ClusterCatalog $TEST_CATALOG_NAME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the actual upgrade comparisons be written in a separate Go test suite instead of using a shell script?
I think this would make it easier to communicate with the catalogd HTTP server and be easier to extend the test suite in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ankitathomas In operator-framework/operator-controller#1003 I started with simple bash, but we ended up extending checks there so I replacing
post-upgrade-checks
withgo test
.You might want to take a similar approach.
We run
go test
from outside of the cluster. Instead ofkubectl port-forward
&curl
which I suggested earlier we will have to proxy somehow with client-go. We cam probably take some inspiration fromkubectl port-forward