Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion e2e-tests/conf/client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: pg-client
image: perconalab/percona-distribution-postgresql:16
image: docker.io/perconalab/percona-distribution-postgresql:16
imagePullPolicy: Always
command:
- sleep
Expand Down
5 changes: 3 additions & 2 deletions e2e-tests/conf/cmctl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ spec:
serviceAccountName: cmctl
containers:
- name: cmctl
image: curlimages/curl
image: docker.io/alpine/curl:latest
imagePullPolicy: Always
command:
- /bin/sh
- -c
- |
curl -fsSL -o /tmp/cmctl https://github.com/cert-manager/cmctl/releases/download/v2.4.1/cmctl_linux_amd64 \
arch="$(uname -m)"; case "$arch" in aarch64|arm64) arch=arm64 ;; *) arch=amd64 ;; esac
curl -fsSL -o /tmp/cmctl "https://github.com/cert-manager/cmctl/releases/download/v2.4.1/cmctl_linux_${arch}" \
&& chmod +x /tmp/cmctl \
&& sleep 100500
restartPolicy: Always
290 changes: 243 additions & 47 deletions e2e-tests/functions

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion e2e-tests/release_versions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder: we need to revert this before merging to main after tests on release branch pass

Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ RANCHER=2.15.1
CERT_MANAGER=1.21.1
OPENSHIFT_MIN=4.18.40
OPENSHIFT_MAX=4.21.14
MINIKUBE_MAX=1.35.1
MINIKUBE_MAX=1.35.1
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ commands:
}
}
' \
| add_arch_to_pg - \
| kubectl -n "${NAMESPACE}" apply -f -
8 changes: 8 additions & 0 deletions e2e-tests/tests/cert-manager-tls/08-delete-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,20 @@ commands:
kubectl -n "$NAMESPACE" delete perconapgcluster cert-manager-tls --wait=true || true
kubectl -n "$NAMESPACE" delete postgrescluster cert-manager-tls --wait=true || true

kubectl -n "$NAMESPACE" delete perconapgbackup --all --wait=true || true
kubectl -n "$NAMESPACE" delete job -l postgres-operator.crunchydata.com/cluster=cert-manager-tls --wait=true || true

kubectl -n "$NAMESPACE" delete pvc -l postgres-operator.crunchydata.com/cluster=cert-manager-tls || true
kubectl -n "$NAMESPACE" delete secret -l postgres-operator.crunchydata.com/cluster=cert-manager-tls || true
kubectl -n "$NAMESPACE" delete configmap internal-pki-cert-serial || true

cluster_deleted() {
! kubectl -n "$NAMESPACE" get postgrescluster cert-manager-tls 2>/dev/null
}
backups_deleted() {
[[ -z "$(kubectl -n "$NAMESPACE" get perconapgbackup -o name 2>/dev/null)" ]] && \
[[ -z "$(kubectl -n "$NAMESPACE" get job -l postgres-operator.crunchydata.com/cluster=cert-manager-tls -o name 2>/dev/null)" ]]
}
retry 12 5 cluster_deleted
retry 12 5 backups_deleted
timeout: 120
6 changes: 3 additions & 3 deletions e2e-tests/tests/custom-extensions/00-deploy-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
- timeout: 200
script: |-
set -o errexit
set -o xtrace

Expand All @@ -12,5 +13,4 @@ commands:
deploy_client
deploy_s3_secrets
deploy_minio
copy_custom_extensions_form_aws
timeout: 200
copy_custom_extensions_from_aws
2 changes: 1 addition & 1 deletion e2e-tests/tests/custom-extensions/01-create-cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- timeout: 60
- timeout: 120
script: |-
set -o errexit
set -o xtrace
Expand Down
30 changes: 16 additions & 14 deletions e2e-tests/tests/custom-extensions/02-install-pg_stat_kcache.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
apiVersion: pgv2.percona.com/v2
kind: PerconaPGCluster
metadata:
name: custom-extensions
spec:
extensions:
custom:
- name: pg_stat_kcache
version: 2.3.1
patroni:
dynamicConfiguration:
postgresql:
parameters:
shared_preload_libraries: pg_stat_statements,pg_stat_kcache
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions

kcache_ver=$(custom_ext_version 2.3.1)
kubectl -n "${NAMESPACE}" patch pg custom-extensions --type merge -p "{
\"spec\": {
\"extensions\": {\"custom\": [{\"name\": \"pg_stat_kcache\", \"version\": \"${kcache_ver}\"}]},
\"patroni\": {\"dynamicConfiguration\": {\"postgresql\": {\"parameters\": {\"shared_preload_libraries\": \"pg_stat_statements,pg_stat_kcache\"}}}}
}
}"
30 changes: 16 additions & 14 deletions e2e-tests/tests/custom-extensions/11-install-pg_stat_kcache.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
apiVersion: pgv2.percona.com/v2
kind: PerconaPGCluster
metadata:
name: custom-extensions
spec:
extensions:
custom:
- name: pg_stat_kcache
version: 2.3.1
patroni:
dynamicConfiguration:
postgresql:
parameters:
shared_preload_libraries: pg_stat_statements,pg_stat_kcache
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions

kcache_ver=$(custom_ext_version 2.3.1)
kubectl -n "${NAMESPACE}" patch pg custom-extensions --type merge -p "{
\"spec\": {
\"extensions\": {\"custom\": [{\"name\": \"pg_stat_kcache\", \"version\": \"${kcache_ver}\"}]},
\"patroni\": {\"dynamicConfiguration\": {\"postgresql\": {\"parameters\": {\"shared_preload_libraries\": \"pg_stat_statements,pg_stat_kcache\"}}}}
}
}"
30 changes: 16 additions & 14 deletions e2e-tests/tests/custom-extensions/14-update-pg_stat_kcache.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
apiVersion: pgv2.percona.com/v2
kind: PerconaPGCluster
metadata:
name: custom-extensions
spec:
extensions:
custom:
- name: pg_stat_kcache
version: 2.3.2
patroni:
dynamicConfiguration:
postgresql:
parameters:
shared_preload_libraries: pg_stat_statements,pg_stat_kcache
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions

kcache_ver=$(custom_ext_version 2.3.2)
kubectl -n "${NAMESPACE}" patch pg custom-extensions --type merge -p "{
\"spec\": {
\"extensions\": {\"custom\": [{\"name\": \"pg_stat_kcache\", \"version\": \"${kcache_ver}\"}]},
\"patroni\": {\"dynamicConfiguration\": {\"postgresql\": {\"parameters\": {\"shared_preload_libraries\": \"pg_stat_statements,pg_stat_kcache\"}}}}
}
}"
37 changes: 17 additions & 20 deletions e2e-tests/tests/custom-extensions/17-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@ kind: TestAssert
# adding pg_cron to the custom list and to shared_preload_libraries restarts
# every instance pod
timeout: 420
---
apiVersion: pgv2.percona.com/v2
kind: PerconaPGCluster
metadata:
name: custom-extensions
status:
installedCustomExtensions:
- pg_stat_kcache
- pg_cron
pgbouncer:
ready: 3
size: 3
postgres:
instances:
- name: instance1
ready: 3
size: 3
ready: 3
size: 3
state: ready
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions

if [[ ${ARCH} == arm64 ]]; then
echo "Skipping custom pg_cron assertion on arm64: pg_cron-*-arm64.tar.gz is not in extension storage"
exit 0
fi

wait_cluster_consistency custom-extensions

installed=$(kubectl -n "${NAMESPACE}" get pg custom-extensions -o jsonpath='{.status.installedCustomExtensions}')
echo "${installed}" | grep -q pg_cron \
|| { echo "ERROR: pg_cron was not recorded as an installed custom extension: ${installed}"; exit 1; }
51 changes: 31 additions & 20 deletions e2e-tests/tests/custom-extensions/17-install-pg_cron.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
apiVersion: pgv2.percona.com/v2
kind: PerconaPGCluster
metadata:
name: custom-extensions
spec:
# pg_cron is installed as a custom extension here so the next steps can move
# it to spec.extensions.pg_cron: it is the only extension that is both
# available as a custom archive and managed as a builtin one, and it owns
# data (the cron.job rows) that a wrong drop would destroy
extensions:
custom:
- name: pg_stat_kcache
version: 2.3.2
- name: pg_cron
version: 1.6.7
patroni:
dynamicConfiguration:
postgresql:
parameters:
shared_preload_libraries: pg_stat_statements,pg_stat_kcache,pg_cron
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions

if [[ ${ARCH} == arm64 ]]; then
echo "Skipping custom pg_cron on arm64: pg_cron-*-arm64.tar.gz is not in extension storage"
exit 0
fi

# pg_cron is installed as a custom extension here so the next steps can move
# it to spec.extensions.pg_cron: it is the only extension that is both
# available as a custom archive and managed as a builtin one, and it owns
# data (the cron.job rows) that a wrong drop would destroy
kcache_ver=$(custom_ext_version 2.3.2)
cron_ver=$(custom_ext_version 1.6.7)
kubectl -n "${NAMESPACE}" patch pg custom-extensions --type merge -p "{
\"spec\": {
\"extensions\": {\"custom\": [
{\"name\": \"pg_stat_kcache\", \"version\": \"${kcache_ver}\"},
{\"name\": \"pg_cron\", \"version\": \"${cron_ver}\"}
]},
\"patroni\": {\"dynamicConfiguration\": {\"postgresql\": {\"parameters\": {\"shared_preload_libraries\": \"pg_stat_statements,pg_stat_kcache,pg_cron\"}}}}
}
}"

wait_cluster_consistency custom-extensions
5 changes: 5 additions & 0 deletions e2e-tests/tests/custom-extensions/18-restart-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ commands:

source ../../functions

if [[ ${ARCH} == arm64 ]]; then
echo "Skipping pg_cron restart on arm64: custom pg_cron was not installed"
exit 0
fi

# pg_cron was added to shared_preload_libraries in the previous step and
# postgres only loads it on start, so the pods have to be restarted before
# the extension can be created
Expand Down
5 changes: 5 additions & 0 deletions e2e-tests/tests/custom-extensions/19-enable-pg_cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ commands:

source ../../functions

if [[ ${ARCH} == arm64 ]]; then
echo "Skipping pg_cron enable on arm64: custom pg_cron was not installed"
exit 0
fi

uri="postgres:$(get_psql_user_pass custom-extensions-pguser-postgres)@$(get_psql_user_host custom-extensions-pguser-postgres)"

# cron.database_name only exists once the pg_cron library is loaded, so it
Expand Down
48 changes: 28 additions & 20 deletions e2e-tests/tests/custom-extensions/20-migrate-to-builtin.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
apiVersion: pgv2.percona.com/v2
kind: PerconaPGCluster
metadata:
name: custom-extensions
spec:
# pg_cron moves from a custom extension to a builtin one: the operator takes
# over its lifecycle, but the extension and its data must survive the move.
# Dropping it here used to be the default behavior, because the extension
# disappears from the custom list.
extensions:
pg_cron:
enabled: true
custom:
- name: pg_stat_kcache
version: 2.3.2
patroni:
dynamicConfiguration:
postgresql:
parameters:
shared_preload_libraries: pg_stat_statements,pg_stat_kcache,pg_cron
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions

if [[ ${ARCH} == arm64 ]]; then
echo "Skipping custom-to-builtin pg_cron migration on arm64: custom pg_cron was not installed"
exit 0
fi

# pg_cron moves from a custom extension to a builtin one: the operator takes
# over its lifecycle, but the extension and its data must survive the move.
# Dropping it here used to be the default behavior, because the extension
# disappears from the custom list.
kcache_ver=$(custom_ext_version 2.3.2)
kubectl -n "${NAMESPACE}" patch pg custom-extensions --type merge -p "{
\"spec\": {
\"extensions\": {
\"pg_cron\": {\"enabled\": true},
\"custom\": [{\"name\": \"pg_stat_kcache\", \"version\": \"${kcache_ver}\"}]
},
\"patroni\": {\"dynamicConfiguration\": {\"postgresql\": {\"parameters\": {\"shared_preload_libraries\": \"pg_stat_statements,pg_stat_kcache,pg_cron\"}}}}
}
}"
5 changes: 5 additions & 0 deletions e2e-tests/tests/custom-extensions/21-check-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ commands:

source ../../functions

if [[ ${ARCH} == arm64 ]]; then
echo "Skipping custom-to-builtin pg_cron check on arm64: custom pg_cron was not installed"
exit 0
fi

uri="postgres:$(get_psql_user_pass custom-extensions-pguser-postgres)@$(get_psql_user_host custom-extensions-pguser-postgres)"

# moving an extension from spec.extensions.custom to a builtin flag must
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ commands:
)
// .
' \
| add_arch_to_pg - \
| kubectl -n "${NAMESPACE}" apply -f -
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ commands:
)
// .
' \
| add_arch_to_pg - \
| kubectl -n "${NAMESPACE}" apply -f -
10 changes: 8 additions & 2 deletions e2e-tests/tests/ldap-tls/02-openldap-tls.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- files/openldap-tls-deploy.yaml
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions

add_arch_to_podspecs files/openldap-tls-deploy.yaml | kubectl -n "${NAMESPACE}" apply -f -
Loading
Loading