Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
regen
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly committed Feb 21, 2024
commit 3c64ba22ad715d296a3248e7799c575bc6d05cf9
24 changes: 11 additions & 13 deletions testing/chainsaw/e2e/exporter-custom-queries/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ metadata:
name: exporter-custom-queries
spec:
steps:
- catch:
- name: step-00
try:
- apply:
file: files/exporter-custom-queries-configmap.yaml
- apply:
file: files/exporter-custom-queries-cluster.yaml
- assert:
file: files/exporter-custom-queries-cluster-checks.yaml
- script:
content: |
retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; }
Expand Down Expand Up @@ -55,15 +62,12 @@ spec:

pid=$(kubectl exec ${pod} -n ${NAMESPACE} -c exporter -- cat /tmp/postgres_exporter.pid)
kubectl annotate --overwrite -n ${NAMESPACE} ${pod} oldpid=${pid}
name: step-00
- name: step-01
try:
- apply:
file: files/exporter-custom-queries-configmap.yaml
- apply:
file: files/exporter-custom-queries-cluster.yaml
file: files/exporter-custom-queries-configmap-update.yaml
- assert:
file: files/exporter-custom-queries-cluster-checks.yaml
- catch:
file: files/exporter-custom-queries-configmap-update-checks.yaml
- script:
content: |
retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; }
Expand Down Expand Up @@ -92,9 +96,3 @@ spec:
echo "${master_queries_contents}"
exit 1
}
name: step-01
try:
- apply:
file: files/exporter-custom-queries-configmap-update.yaml
- assert:
file: files/exporter-custom-queries-configmap-update-checks.yaml
13 changes: 6 additions & 7 deletions testing/chainsaw/e2e/exporter-no-tls/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ metadata:
name: exporter-no-tls
spec:
steps:
- catch:
- name: step-00
try:
- apply:
file: files/exporter-no-tls-cluster.yaml
- assert:
file: files/exporter-no-tls-cluster-checks.yaml
- script:
content: |
retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; }
Expand Down Expand Up @@ -48,9 +53,3 @@ spec:
ASSERT FOUND, 'user not found';
END $$
SQL
name: step-00
try:
- apply:
file: files/exporter-no-tls-cluster.yaml
- assert:
file: files/exporter-no-tls-cluster-checks.yaml
39 changes: 19 additions & 20 deletions testing/chainsaw/e2e/exporter-password-change/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ metadata:
spec:
steps:
- catch:
- script:
content: kubectl -n $NAMESPACE describe pods --selector postgres-operator.crunchydata.com/cluster=exporter-password-change,postgres-operator.crunchydata.com/crunchy-postgres-exporter=true
name: step-00
try:
- apply:
file: files/initial-postgrescluster.yaml
- assert:
file: files/initial-postgrescluster-checks.yaml
- script:
content: |
retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; }
Expand All @@ -23,15 +31,12 @@ spec:
retry "containers not ready"
exit 1
}
- script:
content: kubectl -n $NAMESPACE describe pods --selector postgres-operator.crunchydata.com/cluster=exporter-password-change,postgres-operator.crunchydata.com/crunchy-postgres-exporter=true
name: step-00
try:
- apply:
file: files/initial-postgrescluster.yaml
- assert:
file: files/initial-postgrescluster-checks.yaml
- catch:
- podLogs:
container: exporter
selector: postgres-operator.crunchydata.com/cluster=exporter-password-change,postgres-operator.crunchydata.com/crunchy-postgres-exporter=true
name: step-01
try:
- script:
content: |
retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; }
Expand All @@ -51,12 +56,12 @@ spec:

pid=$(kubectl exec ${pod} -n ${NAMESPACE} -c exporter -- cat /tmp/postgres_exporter.pid)
kubectl annotate --overwrite -n ${NAMESPACE} ${pod} oldpid=${pid}
- podLogs:
container: exporter
selector: postgres-operator.crunchydata.com/cluster=exporter-password-change,postgres-operator.crunchydata.com/crunchy-postgres-exporter=true
name: step-01
try: null
- catch:
- name: step-02
try:
- apply:
file: files/update-monitoring-password.yaml
- assert:
file: files/update-monitoring-password-checks.yaml
- script:
content: |
retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; }
Expand Down Expand Up @@ -84,9 +89,3 @@ spec:
retry "${scrape_metrics}"
exit 1
}
name: step-02
try:
- apply:
file: files/update-monitoring-password.yaml
- assert:
file: files/update-monitoring-password-checks.yaml
17 changes: 8 additions & 9 deletions testing/chainsaw/e2e/exporter-tls/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ metadata:
name: exporter-tls
spec:
steps:
- catch:
- name: step-00
try:
- apply:
file: files/exporter-tls-certs.yaml
- apply:
file: files/exporter-tls-cluster.yaml
- assert:
file: files/exporter-tls-cluster-checks.yaml
- script:
content: |
retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; }
Expand Down Expand Up @@ -49,11 +56,3 @@ spec:
ASSERT FOUND, 'user not found';
END $$
SQL
name: step-00
try:
- apply:
file: files/exporter-tls-certs.yaml
- apply:
file: files/exporter-tls-cluster.yaml
- assert:
file: files/exporter-tls-cluster-checks.yaml
8 changes: 0 additions & 8 deletions testing/chainsaw/e2e/major-upgrade/11-delete-cluster.yaml

This file was deleted.

This file was deleted.

79 changes: 79 additions & 0 deletions testing/chainsaw/e2e/major-upgrade/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: major-upgrade
spec:
steps:
- name: step-01
try:
- apply:
file: 01--invalid-pgupgrade.yaml
- assert:
file: 01-assert.yaml
- name: step-02
try:
- apply:
file: 02--valid-upgrade.yaml
- assert:
file: 02-assert.yaml
- name: step-10
try:
- apply:
file: 10--already-updated-cluster.yaml
- assert:
file: 10-assert.yaml
- name: step-11
try:
- delete:
ref:
apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
name: major-upgrade
- name: step-30
try:
- apply:
file: 30--cluster.yaml
- assert:
file: 30-assert.yaml
- name: step-31
try:
- apply:
file: 31--create-data.yaml
- assert:
file: 31-assert.yaml
- name: step-32
try:
- apply:
file: 32--shutdown-cluster.yaml
- assert:
file: 32-assert.yaml
- name: step-33
try:
- apply:
file: 33--annotate-cluster.yaml
- assert:
file: 33-assert.yaml
- name: step-34
try:
- apply:
file: 34--restart-cluster.yaml
- assert:
file: 34-assert.yaml
- name: step-35
try:
- script:
content: |
kubectl -n "${NAMESPACE}" exec "statefulset.apps/major-upgrade-repo-host" -c pgbackrest -- pgbackrest check --stanza=db
- script:
content: |
# Check that the old pg folders do not exist on the replica
REPLICA=$(kubectl get pod -l=postgres-operator.crunchydata.com/role=replica -n "${NAMESPACE}" -o=jsonpath='{ .items[0].metadata.name }')
kubectl -n "${NAMESPACE}" exec "${REPLICA}" -c database -- [ ! -d "pgdata/pg${KUTTL_PG_UPGRADE_FROM_VERSION}" ]
- name: step-36
try:
- apply:
file: 36--check-data-and-version.yaml
- assert:
file: 36-assert.yaml
25 changes: 10 additions & 15 deletions testing/chainsaw/e2e/standalone-pgadmin/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ spec:
file: files/00-pgadmin.yaml
- assert:
file: files/00-pgadmin-check.yaml
- catch:
- name: step-01
try:
- script:
content: |
contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; }
Expand All @@ -28,8 +29,6 @@ spec:
echo "Wrong servers dumped: got ${clusters_actual}"
exit 1
}
name: step-01
try: null
- name: step-02
try:
- apply:
Expand All @@ -38,7 +37,8 @@ spec:
file: files/02-pgadmin.yaml
- assert:
file: files/02-cluster-check.yaml
- catch:
- name: step-03
try:
- script:
content: |
contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; }
Expand Down Expand Up @@ -107,15 +107,14 @@ spec:
diff_comp "${clusters_actual}" "${clusters_expected}"
exit 1
}
name: step-03
try: null
- name: step-04
try:
- apply:
file: files/04-cluster.yaml
- assert:
file: files/04-cluster-check.yaml
- catch:
- name: step-05
try:
- script:
content: |
contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; }
Expand Down Expand Up @@ -209,8 +208,6 @@ spec:
diff_comp "${clusters_actual}" "${clusters_expected}"
exit 1
}
name: step-05
try: null
- name: step-06
try:
- apply:
Expand All @@ -219,7 +216,8 @@ spec:
file: files/06-pgadmin.yaml
- assert:
file: files/06-cluster-check.yaml
- catch:
- name: step-07
try:
- script:
content: |
contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; }
Expand Down Expand Up @@ -336,8 +334,6 @@ spec:
diff_comp "${clusters_actual}" "${clusters_expected}"
exit 1
}
name: step-07
try: null
- name: step-08
try:
- error:
Expand All @@ -347,7 +343,8 @@ spec:
apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
name: pgadmin2
- catch:
- name: step-09
try:
- script:
content: |
contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; }
Expand Down Expand Up @@ -441,5 +438,3 @@ spec:
diff_comp "${clusters_actual}" "${clusters_expected}"
exit 1
}
name: step-09
try: null