File tree Expand file tree Collapse file tree 1 file changed +11
-31
lines changed
testing/kuttl/e2e/version Expand file tree Collapse file tree 1 file changed +11
-31
lines changed Original file line number Diff line number Diff line change @@ -2,45 +2,25 @@ apiVersion: kuttl.dev/v1beta1
22kind : TestStep
33commands :
44- script : |
5- VERSION_OUTPUT=$(kubectl pgo version)
6- CLI_VERSION=$(kubectl pgo version | awk '{print $3}')
5+ contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; }
76
8- # the CLI version isn't empty and the CLI version output follows the expected format
9- if [ -z "$CLI_VERSION" ]; then
10- echo "Client version output is empty."
7+ VERSION_OUTPUT=$(kubectl pgo version)
8+ { contains "${VERSION_OUTPUT}" "Client Version:"; } || {
9+ echo ${VERSION_OUTPUT}
1110 exit 1
12- fi
13-
14- case "${VERSION_OUTPUT}" in
15- *"Client Version: "*)
16- ;;
17- *)
18- echo "Version output is: "
19- echo "$VERSION_OUTPUT"
20- exit 1
21- ;;
22- esac
11+ }
2312 - script : |
13+ contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; }
14+
2415 OPERATOR_VERSION=$(
2516 kubectl get crd postgresclusters.postgres-operator.crunchydata.com \
2617 -o go-template='{{ index .metadata.labels "app.kubernetes.io/version" }}'
2718 )
2819
2920 VERSION_OUTPUT=$(kubectl pgo version)
3021
31- # the operator version isn't empty and the version output matches the CRD value
32- if [ -z "$OPERATOR_VERSION" ]; then
33- echo "Operator version output is empty."
22+ { contains "${VERSION_OUTPUT}" "Operator Version: v${OPERATOR_VERSION}"; } || {
23+ echo ${VERSION_OUTPUT}
24+ echo ${OPERATOR_VERSION}
3425 exit 1
35- fi
36-
37- case "${VERSION_OUTPUT}" in
38- *"Operator Version: v$OPERATOR_VERSION"*)
39- ;;
40- *)
41- echo "Version output is: "
42- echo "$VERSION_OUTPUT"
43- echo "Expected: v$OPERATOR_VERSION"
44- exit 1
45- ;;
46- esac
26+ }
You can’t perform that action at this time.
0 commit comments