-
Notifications
You must be signed in to change notification settings - Fork 205
test(cluster): Add support for extension upgrade test under cluster/test/database-management #773
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
Open
philippemnoel
wants to merge
8
commits into
cloudnative-pg:main
Choose a base branch
from
paradedb:phil/ext-upgrade-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a6495bb
Extension upgrade test
philippemnoel ae0a2c5
Rm DSStore
philippemnoel 6d071f9
-cluster
philippemnoel 1f0eece
-cluster
philippemnoel 6f579c1
Old version
philippemnoel ec83768
Fix name
philippemnoel 465c600
Nits
philippemnoel 3191e62
Merge branch 'cloudnative-pg:main' into phil/ext-upgrade-test
philippemnoel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
charts/cluster/test/database-management/02-extension-upgrade-init-assert.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| apiVersion: postgresql.cnpg.io/v1 | ||
| kind: Cluster | ||
| metadata: | ||
| name: extension-upgrade-cluster | ||
| status: | ||
| readyInstances: 2 | ||
| phase: Cluster in healthy state | ||
| --- | ||
| apiVersion: postgresql.cnpg.io/v1 | ||
| kind: Database | ||
| metadata: | ||
| name: extension-upgrade-cluster-cluster | ||
| spec: | ||
| name: test-db-icu | ||
|
Contributor
Author
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. @itay-grudev let me know if this is not right. I based it on 01-database-parameters. |
||
| cluster: | ||
| name: extension-upgrade-cluster | ||
| ensure: present | ||
| owner: test-owner | ||
| template: template1 | ||
| encoding: UTF8 | ||
| databaseReclaimPolicy: retain | ||
| extensions: | ||
| - name: pg_search | ||
| ensure: present | ||
| version: "0.19.10" | ||
16 changes: 16 additions & 0 deletions
16
charts/cluster/test/database-management/02-extension-upgrade-init.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| type: postgresql | ||
| version: | ||
| postgresql: "17" | ||
| paradedb: "0.19.10" | ||
|
|
||
| cluster: | ||
| instances: 2 | ||
|
|
||
| databases: | ||
| - name: test-db-icu | ||
| ensure: present | ||
| owner: test-owner | ||
| encoding: UTF8 | ||
| extensions: | ||
| - name: pg_search | ||
| ensure: present |
6 changes: 6 additions & 0 deletions
6
charts/cluster/test/database-management/03-paradedb_extension_check-assert.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: test-db-icu-version-check-before | ||
| status: | ||
| succeeded: 1 |
32 changes: 32 additions & 0 deletions
32
charts/cluster/test/database-management/03-paradedb_extension_check.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: test-db-icu-version-check-before | ||
| spec: | ||
| template: | ||
| spec: | ||
| restartPolicy: OnFailure | ||
| containers: | ||
| - name: data-test | ||
| env: | ||
| - name: DB_URI | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: extension-upgrade-cluster-app | ||
| key: uri | ||
| image: alpine:3.19 | ||
| command: ['sh', '-c'] | ||
| args: | ||
| - | | ||
| apk --no-cache add postgresql-client | ||
| PG_SEARCH_VERSION=$(psql "$DB_URI" -t) <<-EOSQL | ||
| SELECT version FROM paradedb.version_info(); | ||
| EOSQL | ||
| echo $PG_SEARCH_VERSION | ||
| test "$PG_SEARCH_VERSION" = " 0.19.10" | ||
|
|
||
| EXTVERSION=$(psql "$DB_URI" -t) <<-EOSQL | ||
| SELECT extversion FROM pg_extension WHERE extname = 'pg_search'; | ||
| EOSQL | ||
| echo $EXTVERSION | ||
| test "$EXTVERSION" = " 0.19.10" |
25 changes: 25 additions & 0 deletions
25
charts/cluster/test/database-management/04-extension-upgrade-post-assert.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| apiVersion: postgresql.cnpg.io/v1 | ||
| kind: Cluster | ||
| metadata: | ||
| name: extension-upgrade-cluster | ||
| status: | ||
| readyInstances: 2 | ||
| phase: Cluster in healthy state | ||
| --- | ||
| apiVersion: postgresql.cnpg.io/v1 | ||
| kind: Database | ||
| metadata: | ||
| name: extension-upgrade-cluster-cluster | ||
| spec: | ||
| name: test-db-icu | ||
| cluster: | ||
| name: extension-upgrade-cluster | ||
| ensure: present | ||
| owner: test-owner | ||
| template: template1 | ||
| encoding: UTF8 | ||
| databaseReclaimPolicy: retain | ||
| extensions: | ||
| - name: pg_search | ||
| ensure: present | ||
| version: "0.19.11" |
16 changes: 16 additions & 0 deletions
16
charts/cluster/test/database-management/04-extension-upgrade-post.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| type: postgresql | ||
| version: | ||
| postgresql: "17" | ||
| paradedb: "0.19.11" | ||
|
|
||
| cluster: | ||
| instances: 2 | ||
|
|
||
| databases: | ||
| - name: test-db-icu | ||
| ensure: present | ||
| owner: test-owner | ||
| encoding: UTF8 | ||
| extensions: | ||
| - name: pg_search | ||
| ensure: present |
6 changes: 6 additions & 0 deletions
6
charts/cluster/test/database-management/05-paradedb_extension_check-assert.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: test-db-icu-version-check-after | ||
| status: | ||
| succeeded: 1 |
32 changes: 32 additions & 0 deletions
32
charts/cluster/test/database-management/05-paradedb_extension_check.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: test-db-icu-version-check-after | ||
| spec: | ||
| template: | ||
| spec: | ||
| restartPolicy: OnFailure | ||
| containers: | ||
| - name: data-test | ||
| env: | ||
| - name: DB_URI | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: extension-upgrade-cluster-app | ||
| key: uri | ||
| image: alpine:3.19 | ||
| command: ['sh', '-c'] | ||
| args: | ||
| - | | ||
| apk --no-cache add postgresql-client | ||
| PG_SEARCH_VERSION=$(psql "$DB_URI" -t) <<-EOSQL | ||
| SELECT version FROM paradedb.version_info(); | ||
| EOSQL | ||
| echo $PG_SEARCH_VERSION | ||
| test "$PG_SEARCH_VERSION" = " 0.19.11" | ||
|
|
||
| EXTVERSION=$(psql "$DB_URI" -t) <<-EOSQL | ||
| SELECT extversion FROM pg_extension WHERE extname = 'pg_search'; | ||
| EOSQL | ||
| echo $EXTVERSION | ||
| test "$EXTVERSION" = " 0.19.11" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
charts/paradedb/test/database-management/chainsaw-test.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
| kind: Test | ||
| metadata: | ||
| name: database-management | ||
| spec: | ||
| timeouts: | ||
| apply: 1s | ||
| assert: 300s | ||
| cleanup: 60s | ||
| steps: | ||
| - name: database-parameters | ||
| timeouts: | ||
| apply: 1s | ||
| assert: 5s | ||
| cleanup: 30s | ||
| try: | ||
| - script: | ||
| content: | | ||
| helm upgrade \ | ||
| --install \ | ||
| --namespace $NAMESPACE \ | ||
| --values ./01-database-parameters.yaml \ | ||
| --wait \ | ||
| database-parameters ../../ | ||
| - assert: | ||
| file: ./01-database-parameters-assert.yaml | ||
|
|
||
| - name: Provision a cluster with a database with the pg_search extension | ||
| try: | ||
| - script: | ||
| content: | | ||
| helm upgrade \ | ||
| --install \ | ||
| --namespace $NAMESPACE \ | ||
| --values ./02-extension-upgrade-init.yaml \ | ||
| --wait \ | ||
| extension-upgrade ../../ | ||
| - assert: | ||
| file: ./02-extension-upgrade-init-assert.yaml | ||
| catch: | ||
| - describe: | ||
| apiVersion: postgresql.cnpg.io/v1 | ||
| kind: Cluster | ||
| name: extension-upgrade-cluster | ||
| - podLogs: | ||
| selector: cnpg.io/cluster=extension-upgrade-cluster | ||
| - script: | ||
| content: | | ||
| echo "=== Cluster Status ===" | ||
| kubectl get cluster extension-upgrade-cluster -n $NAMESPACE -o yaml | grep -A 50 "status:" | ||
| echo "=== Pod Status ===" | ||
| kubectl get pods -n $NAMESPACE -l cnpg.io/cluster=extension-upgrade-cluster -o wide | ||
| echo "=== Pod Events ===" | ||
| kubectl get events -n $NAMESPACE --sort-by='.lastTimestamp' | tail -30 | ||
|
|
||
| - name: Verify the ParadeDB extension version before upgrade | ||
| try: | ||
| - apply: | ||
| file: ./03-cluster_extension_check.yaml | ||
| - assert: | ||
| file: ./03-cluster_extension_check-assert.yaml | ||
|
|
||
| - name: Upgrade the ParadeDB cluster and the extension | ||
| try: | ||
| - script: | ||
| content: | | ||
| helm upgrade \ | ||
| --install \ | ||
| --namespace $NAMESPACE \ | ||
| --values ./04-extension-upgrade-post.yaml \ | ||
| --wait \ | ||
| extension-upgrade ../../ | ||
| - assert: | ||
| file: ./04-extension-upgrade-post-assert.yaml | ||
|
|
||
| - name: Verify the ParadeDB extension version after upgrade | ||
| try: | ||
| - apply: | ||
| file: ./05-cluster_extension_check.yaml | ||
| - assert: | ||
| file: ./05-cluster_extension_check-assert.yaml | ||
|
|
||
| - name: cleanup | ||
| try: | ||
| - script: | ||
| content: | | ||
| helm uninstall --namespace $NAMESPACE database-parameters | ||
| helm uninstall --namespace $NAMESPACE extension-upgrade |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.