forked from cloudnative-pg/charts
-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Test: Added test for index replication #74
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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 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 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 |
---|---|---|
|
@@ -3,4 +3,4 @@ kind: Cluster | |
metadata: | ||
name: paradedb-ncc-1701-d | ||
status: | ||
readyInstances: 1 | ||
readyInstances: 2 |
This file contains 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 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
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/paradedb-enterprise/03-paradedb_test-assert.yaml
This file contains 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: paradedb-enterprise-index-test | ||
status: | ||
succeeded: 1 |
46 changes: 46 additions & 0 deletions
46
charts/paradedb/test/paradedb-enterprise/03-paradedb_test.yaml
This file contains 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,46 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: paradedb-enterprise-index-test | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-test | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: paradedb-ncc-1701-d-app | ||
key: uri | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client | ||
DB_URI="${DB_URI/paradedb-ncc-1701-d-rw/paradedb-ncc-1701-d-ro}" | ||
RESULT=$(psql "$DB_URI" -t) <<-EOSQL | ||
SELECT description | ||
FROM mock_items_paradedb_enterprise | ||
WHERE description @@@ '"bluetooth speaker"~1' | ||
LIMIT 1; | ||
EOSQL | ||
echo -$RESULT- | ||
if [ "$RESULT" = " Bluetooth-enabled speaker" ]; then | ||
echo "Test for description search on replicas passed." | ||
else | ||
echo "Test for description search on replicas failed." | ||
exit 1 | ||
fi | ||
|
||
SIZE_RESULT=$(psql "$DB_URI" -t) <<-EOSQL | ||
SELECT pg_size_pretty(pg_relation_size('search_idx')); | ||
EOSQL | ||
echo -$SIZE_RESULT- | ||
if [ "$SIZE_RESULT" != " 0 bytes" ]; then | ||
echo "Test for index size on replicas passed." | ||
else | ||
echo "Test for index size on replicas failed." | ||
exit 1 | ||
fi |
This file contains 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
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-minio-backup-restore/00-minio_cleanup-assert.yaml
This file contains 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: data-test | ||
status: | ||
succeeded: 1 |
16 changes: 16 additions & 0 deletions
16
charts/paradedb/test/postgresql-minio-backup-restore/00-minio_cleanup.yaml
This file contains 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 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: minio-cleanup | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: minio-cleanup | ||
image: minio/mc | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
mc alias set myminio https://minio.minio.svc.cluster.local minio minio123 | ||
mc rm --recursive --force myminio/mybucket/paradedb |
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-minio-backup-restore/01-standalone_cluster-assert.yaml
This file contains 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: postgresql.cnpg.io/v1 | ||
kind: Cluster | ||
metadata: | ||
name: import-paradedb | ||
status: | ||
readyInstances: 2 |
29 changes: 29 additions & 0 deletions
29
charts/paradedb/test/postgresql-minio-backup-restore/01-standalone_cluster.yaml
This file contains 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,29 @@ | ||
type: paradedb | ||
mode: standalone | ||
version: | ||
major: "17" | ||
paradedb: "0.13.2" | ||
cluster: | ||
instances: 2 | ||
storage: | ||
size: 256Mi | ||
|
||
backups: | ||
enabled: true | ||
provider: s3 | ||
endpointURL: "https://minio.minio.svc.cluster.local" | ||
endpointCA: | ||
name: kube-root-ca.crt | ||
key: ca.crt | ||
wal: | ||
encryption: "" | ||
data: | ||
encryption: "" | ||
s3: | ||
bucket: "mybucket" | ||
path: "/paradedb/v1" | ||
accessKey: "minio" | ||
secretKey: "minio123" | ||
region: "local" | ||
scheduledBackups: [] | ||
retentionPolicy: "30d" |
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-minio-backup-restore/02-data_write-assert.yaml
This file contains 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: data-write | ||
status: | ||
succeeded: 1 |
23 changes: 23 additions & 0 deletions
23
charts/paradedb/test/postgresql-minio-backup-restore/02-data_write.yaml
This file contains 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,23 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-write | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-write | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: standalone-paradedb-superuser | ||
key: uri | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client | ||
DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) | ||
psql "$DB_URI" -c "CREATE TABLE mygoodtable (id serial PRIMARY KEY);" |
8 changes: 8 additions & 0 deletions
8
charts/paradedb/test/postgresql-minio-backup-restore/03-backup.yaml
This file contains 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,8 @@ | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Backup | ||
metadata: | ||
name: post-init-backup | ||
spec: | ||
method: barmanObjectStore | ||
cluster: | ||
name: standalone-paradedb |
10 changes: 10 additions & 0 deletions
10
charts/paradedb/test/postgresql-minio-backup-restore/03-backup_completed-assert.yaml
This file contains 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,10 @@ | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Backup | ||
metadata: | ||
name: post-init-backup | ||
spec: | ||
cluster: | ||
name: standalone-paradedb | ||
method: barmanObjectStore | ||
status: | ||
phase: completed |
10 changes: 10 additions & 0 deletions
10
charts/paradedb/test/postgresql-minio-backup-restore/03-backup_running-assert.yaml
This file contains 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,10 @@ | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Backup | ||
metadata: | ||
name: post-init-backup | ||
spec: | ||
cluster: | ||
name: standalone-paradedb | ||
method: barmanObjectStore | ||
status: | ||
phase: running |
27 changes: 27 additions & 0 deletions
27
charts/paradedb/test/postgresql-minio-backup-restore/03-checkpoint.yaml
This file contains 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,27 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: backup-checkpoint | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: create-checkpoint | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: standalone-paradedb-superuser | ||
key: uri | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client | ||
DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) | ||
END_TIME=$(( $(date +%s) + 30 )) | ||
while [ $(date +%s) -lt $END_TIME ]; do | ||
psql "$DB_URI" -c "SELECT pg_switch_wal();CHECKPOINT;" | ||
sleep 5 | ||
done |
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-minio-backup-restore/04-post_backup_data_write-assert.yaml
This file contains 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: data-write-post-backup | ||
status: | ||
succeeded: 1 |
57 changes: 57 additions & 0 deletions
57
charts/paradedb/test/postgresql-minio-backup-restore/04-post_backup_data_write.yaml
This file contains 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,57 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: configmap-creator-sa | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: configmap-creator | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["configmaps"] | ||
verbs: ["create"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: configmap-creator-binding | ||
subjects: | ||
- kind: ServiceAccount | ||
name: configmap-creator-sa | ||
roleRef: | ||
kind: Role | ||
name: configmap-creator | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-write-post-backup | ||
spec: | ||
template: | ||
spec: | ||
serviceAccountName: configmap-creator-sa | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-write | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: standalone-paradedb-superuser | ||
key: uri | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client kubectl coreutils | ||
DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) | ||
DATE_NO_BAD_TABLE=$(date --rfc-3339=ns) | ||
sleep 30 | ||
psql "$DB_URI" -c "CREATE TABLE mybadtable (id serial PRIMARY KEY);" | ||
kubectl create configmap date-no-bad-table --from-literal=date="$DATE_NO_BAD_TABLE" |
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-minio-backup-restore/05-recovery_backup_cluster-assert.yaml
This file contains 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: postgresql.cnpg.io/v1 | ||
kind: Cluster | ||
metadata: | ||
name: import-schemaonly-paradedb | ||
status: | ||
readyInstances: 2 |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to stay with that name, so the index name is different from that of other tests. We only allow one BM25 index per table, and we have two tests here which each create an index on the mock_items table.