Skip to content

Commit ca9a5b6

Browse files
committed
Add a tablespace volume to the restore E2E test
1 parent 1078fe6 commit ca9a5b6

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

testing/chainsaw/e2e/pgbackrest-restore/01-create-cluster.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ spec:
2323
max_connections: 200
2424
instances:
2525
- dataVolumeClaimSpec: ($volume)
26+
tablespaceVolumes:
27+
- { name: barn, dataVolumeClaimSpec: ($volume) }
2628
replicas: 2
2729
backups:
2830
pgbackrest:

testing/chainsaw/e2e/pgbackrest-restore/02-create-data.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ metadata:
44
name: 02-create-data
55
spec:
66
try:
7+
-
8+
description: >
9+
Create a tablespace and grant access to all Postgres users
10+
script:
11+
skipCommandOutput: true
12+
content: |
13+
PRIMARY=$(
14+
kubectl get pod --namespace "${NAMESPACE}" \
15+
--output name --selector '
16+
postgres-operator.crunchydata.com/cluster=original,
17+
postgres-operator.crunchydata.com/role=master'
18+
)
19+
20+
kubectl exec --stdin --namespace "${NAMESPACE}" "${PRIMARY}" -- psql -q --file=- <<'SQL'
21+
CREATE TABLESPACE barn LOCATION '/tablespaces/barn/data';
22+
GRANT ALL ON TABLESPACE barn TO public;
23+
SQL
24+
725
-
826
description: >
927
Create some data that will be restored
@@ -33,6 +51,7 @@ spec:
3351
- |
3452
CREATE SCHEMA IF NOT EXISTS "original";
3553
CREATE TABLE important (data) AS VALUES ('treasure');
54+
CREATE TABLE cows (name) TABLESPACE barn AS VALUES ('nellie');
3655
3756
- assert:
3857
resource:

testing/chainsaw/e2e/pgbackrest-restore/clone-cluster.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ spec:
2626
postgresVersion: ($postgres.version)
2727
instances:
2828
- dataVolumeClaimSpec: ($volume)
29+
tablespaceVolumes:
30+
- { name: barn, dataVolumeClaimSpec: ($volume) }
2931
backups:
3032
pgbackrest:
3133
repos:

testing/chainsaw/e2e/pgbackrest-restore/verify-02-data.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ spec:
6363
BEGIN
6464
SELECT jsonb_agg(important) INTO restored FROM important;
6565
ASSERT restored = '[{"data":"treasure"}]', format('got %L', restored);
66+
67+
SELECT jsonb_agg(cows) INTO restored FROM cows;
68+
ASSERT restored = '[{"name":"nellie"}]', format('got %L', restored);
6669
END $$$$;
6770
6871
- assert:

0 commit comments

Comments
 (0)