Skip to content

Commit

Permalink
Update 'backup' KUTTL test
Browse files Browse the repository at this point in the history
Improve error printing behavior and ensure a backup annotation race
condition won't happen in faster test environments.
  • Loading branch information
tjmoore4 committed Oct 27, 2023
1 parent 59f5b43 commit 9a8503c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions testing/kuttl/e2e/backup/08--backup-with-just-trigger.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
- script: |
pgbackrest_backup_annotation() {
kubectl get --namespace "${NAMESPACE}" postgrescluster/backup-cluster \
--output 'go-template={{ index .metadata.annotations "postgres-operator.crunchydata.com/pgbackrest-backup" }}'
}
PRIOR=$(pgbackrest_backup_annotation)
# ensure annotation timestamp will be different
sleep 1
RESULT=$(kubectl-pgo --namespace "${NAMESPACE}" backup backup-cluster)
CURRENT=$(pgbackrest_backup_annotation)
if [ "${CURRENT}" = "${PRIOR}" ]; then
printf 'Expected annotation to change, got %q' "${CURRENT}"
printf 'Expected annotation to change, got %q\n' "${CURRENT}"
exit 1
fi
Expand Down
4 changes: 2 additions & 2 deletions testing/kuttl/e2e/backup/11--backup-with-new-flag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ commands:
echo "RESULT from taking backup: ${RESULT}"
if [ "${STATUS-0}" -eq 0 ]; then
printf 'Expected error, got none'
printf 'Expected error, got none\n'
exit 1
fi
if [[ "${RESULT,,}" != *conflict* || "${RESULT}" != *repoName* ]]; then
printf 'Expected conflict on repoName, got %q' "${RESULT}"
printf 'Expected conflict on repoName, got %q\n' "${RESULT}"
exit 1
fi

0 comments on commit 9a8503c

Please sign in to comment.