Skip to content

Commit f03b78b

Browse files
committed
add an overlay integration test
1 parent df4d835 commit f03b78b

3 files changed

Lines changed: 337 additions & 4 deletions

File tree

.github/workflows/integration.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
test-invalid-secret
3535
test-missing-secret
3636
needs_non_pg_snapshot: false
37+
needs_cnpg: false
3738

3839
- name: error-paths
3940
tests: >-
@@ -43,20 +44,31 @@ jobs:
4344
test-non-pg-data
4445
test-wrong-bucket
4546
needs_non_pg_snapshot: true
47+
needs_cnpg: false
4648

4749
- name: ttls
4850
tests: >-
4951
minimum_ttl_prevents_premature_restore
5052
namespaces: >-
5153
test-min-ttl
5254
needs_non_pg_snapshot: true
55+
needs_cnpg: false
5356

5457
- name: switchover
5558
tests: >-
5659
second_restore_and_switchover
5760
namespaces: >-
5861
test-switchover
5962
needs_non_pg_snapshot: false
63+
needs_cnpg: false
64+
65+
- name: overlay
66+
tests: >-
67+
overlay_fdw_reconciliation
68+
namespaces: >-
69+
test-overlay
70+
needs_non_pg_snapshot: false
71+
needs_cnpg: true
6072

6173
steps:
6274
- uses: actions/checkout@v6
@@ -117,6 +129,20 @@ jobs:
117129
docker pull alpine:latest
118130
kind load docker-image minio/minio:latest minio/mc:latest kopia/kopia:latest postgres:16 postgres:16-alpine alpine:latest
119131
132+
- name: Pre-pull CNPG images
133+
if: matrix.needs_cnpg
134+
run: |
135+
docker pull ghcr.io/cloudnative-pg/cloudnative-pg:1.25.1
136+
docker pull ghcr.io/cloudnative-pg/postgresql:17
137+
kind load docker-image ghcr.io/cloudnative-pg/cloudnative-pg:1.25.1 ghcr.io/cloudnative-pg/postgresql:17
138+
139+
- name: Install CNPG operator
140+
if: matrix.needs_cnpg
141+
run: |
142+
kubectl apply --server-side -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.25/releases/cnpg-1.25.1.yaml
143+
kubectl wait --for=condition=Available deployment/cnpg-controller-manager -n cnpg-system --timeout=120s
144+
echo "CNPG operator is ready"
145+
120146
- name: Deploy MinIO
121147
run: |
122148
kubectl apply -f tests/fixtures/minio.yaml
@@ -232,6 +258,9 @@ jobs:
232258
kubectl get all -n "$ns" 2>/dev/null || true
233259
done
234260
261+
echo "=== CNPG Clusters ==="
262+
kubectl get clusters.postgresql.cnpg.io -A -o yaml 2>/dev/null || true
263+
235264
echo "=== PostgresPhysicalReplicas ==="
236265
kubectl get postgresphysicalreplicas -A -o yaml 2>/dev/null || true
237266

tests/fixtures/setup-kopia-repo.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ spec:
3434
mkdir -p /pgdata/16/main
3535
chown postgres:postgres /pgdata/16/main
3636
gosu postgres initdb -D /pgdata/16/main --no-locale --encoding=UTF8 --auth=trust
37+
38+
echo "Starting temporary PostgreSQL to create application database..."
39+
gosu postgres pg_ctl -D /pgdata/16/main -l /tmp/pg.log start -w
40+
41+
gosu postgres psql -d postgres -c "CREATE DATABASE myapp"
42+
gosu postgres psql -d myapp -c "CREATE TABLE test_data (id serial PRIMARY KEY, data text)"
43+
gosu postgres psql -d myapp -c "INSERT INTO test_data (data) SELECT repeat('x', 1000) FROM generate_series(1, 1000)"
44+
echo "Application database 'myapp' created with test data"
45+
46+
gosu postgres pg_ctl -D /pgdata/16/main stop -w
47+
3748
echo "PostgreSQL data directory initialized"
3849
ls -la /pgdata/16/main/
3950
cat /pgdata/16/main/PG_VERSION

0 commit comments

Comments
 (0)