File tree Expand file tree Collapse file tree 6 files changed +135
-0
lines changed
testing/kuttl/e2e/tablespace-enabled Expand file tree Collapse file tree 6 files changed +135
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,7 @@ jobs:
130
130
--env 'RELATED_IMAGE_POSTGRES_13_GIS_3.1=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-13.9-3.1-2' \
131
131
--env 'RELATED_IMAGE_POSTGRES_14=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.6-2' \
132
132
--env 'RELATED_IMAGE_POSTGRES_14_GIS_3.1=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-14.6-3.1-2' \
133
+ --env 'PGO_FEATURE_GATES=TablespaceVolumes=true' \
133
134
--name 'postgres-operator' ubuntu \
134
135
postgres-operator
135
136
- name : Install kuttl
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ kind : ConfigMap
3
+ metadata :
4
+ name : tablespace-script
5
+ data :
6
+ script.sql : |
7
+ CREATE TABLESPACE trial OWNER "tablespace-enabled" LOCATION '/tablespaces/library/data';
8
+ ---
9
+ apiVersion : postgres-operator.crunchydata.com/v1beta1
10
+ kind : PostgresCluster
11
+ metadata :
12
+ name : tablespace-enabled
13
+ spec :
14
+ databaseInitSQL :
15
+ name : tablespace-script
16
+ key : script.sql
17
+ postgresVersion : ${KUTTL_PG_VERSION}
18
+ instances :
19
+ - name : instance1
20
+ dataVolumeClaimSpec :
21
+ accessModes :
22
+ - " ReadWriteOnce"
23
+ resources :
24
+ requests :
25
+ storage : 1Gi
26
+ tablespaceVolumes :
27
+ - name : user
28
+ dataVolumeClaimSpec :
29
+ accessModes :
30
+ - " ReadWriteOnce"
31
+ resources :
32
+ requests :
33
+ storage : 1Gi
34
+ - name : library
35
+ dataVolumeClaimSpec :
36
+ accessModes :
37
+ - " ReadWriteOnce"
38
+ resources :
39
+ requests :
40
+ storage : 1Gi
41
+ backups :
42
+ pgbackrest :
43
+ repos :
44
+ - name : repo1
45
+ volume :
46
+ volumeClaimSpec :
47
+ accessModes :
48
+ - " ReadWriteOnce"
49
+ resources :
50
+ requests :
51
+ storage : 1Gi
Original file line number Diff line number Diff line change
1
+ apiVersion : postgres-operator.crunchydata.com/v1beta1
2
+ kind : PostgresCluster
3
+ metadata :
4
+ name : tablespace-enabled
5
+ status :
6
+ instances :
7
+ - name : instance1
8
+ readyReplicas : 1
9
+ replicas : 1
10
+ updatedReplicas : 1
11
+ ---
12
+ apiVersion : batch/v1
13
+ kind : Job
14
+ metadata :
15
+ labels :
16
+ postgres-operator.crunchydata.com/cluster : tablespace-enabled
17
+ postgres-operator.crunchydata.com/pgbackrest-backup : replica-create
18
+ status :
19
+ succeeded : 1
20
+ ---
21
+ apiVersion : v1
22
+ kind : Service
23
+ metadata :
24
+ name : tablespace-enabled-primary
Original file line number Diff line number Diff line change
1
+ apiVersion : batch/v1
2
+ kind : Job
3
+ metadata :
4
+ name : psql-connect
5
+ spec :
6
+ backoffLimit : 6
7
+ template :
8
+ spec :
9
+ restartPolicy : Never
10
+ containers :
11
+ - name : psql
12
+ image : ${KUTTL_PSQL_IMAGE}
13
+ env :
14
+ - name : PGURI
15
+ valueFrom : { secretKeyRef: { name: tablespace-enabled-pguser-tablespace-enabled, key: uri } }
16
+
17
+ # Do not wait indefinitely.
18
+ - { name: PGCONNECT_TIMEOUT, value: '5' }
19
+
20
+ # Note: the `$$$$` is reduced to `$$` by Kubernetes.
21
+ # - https://kubernetes.io/docs/tasks/inject-data-application/
22
+ command :
23
+ - psql
24
+ - $(PGURI)
25
+ - --quiet
26
+ - --echo-errors
27
+ - --set=ON_ERROR_STOP=1
28
+ - --command
29
+ - |
30
+ DO $$$$
31
+ DECLARE
32
+ tbsp_count integer;
33
+ BEGIN
34
+ SELECT COUNT(*) INTO tbsp_count FROM pg_tablespace WHERE spcname = 'trial';
35
+ ASSERT tbsp_count = 1, 'tablespace not found';
36
+ END $$$$;
37
+ - --command
38
+ - |
39
+ CREATE TABLE users(
40
+ id BIGINT GENERATED ALWAYS AS IDENTITY,
41
+ PRIMARY KEY(id),
42
+ hash_firstname TEXT NOT NULL,
43
+ favorite_dog TEXT NOT NULL) TABLESPACE trial;
44
+ INSERT INTO users(hash_firstname, favorite_dog) SELECT
45
+ md5(RANDOM()::TEXT),
46
+ CASE WHEN RANDOM() < 0.5 THEN 'beagle' ELSE 'schnauzer' END
47
+ FROM generate_series(1, 10000);
Original file line number Diff line number Diff line change
1
+ apiVersion : batch/v1
2
+ kind : Job
3
+ metadata :
4
+ name : psql-connect
5
+ status :
6
+ succeeded : 1
Original file line number Diff line number Diff line change
1
+ # Tablespace Enabled
2
+
3
+ ** Note** : This series of tests depends on PGO being deployed with the ` TablespaceVolume ` feature gate enabled.
4
+
5
+ 00: Start a cluster with tablespace volumes and a configmap ` databaseInitSQL ` to create a tablespace with the non-superuser as owner
6
+ 01: Connect to the db, check that the tablespace exists, and create a table in the tablespace
You can’t perform that action at this time.
0 commit comments