|
| 1 | +suite: postgres image flavor |
| 2 | +# The Cluster and the init Job must resolve the same image, and a live |
| 3 | +# cluster must never be moved to the other flavor: the two image families |
| 4 | +# ship different glibc versions, so CNPG would roll an image swap that |
| 5 | +# corrupts collatable indexes. Tags are matched by pattern so that |
| 6 | +# hack/update-versions.sh can bump minors without touching this suite. |
| 7 | +release: |
| 8 | + name: pg-test |
| 9 | + namespace: tenant-test |
| 10 | +set: |
| 11 | + _cluster: |
| 12 | + scheduling: {} |
| 13 | +tests: |
| 14 | + - it: defaults to the CloudNativePG PostgreSQL image |
| 15 | + templates: |
| 16 | + - templates/db.yaml |
| 17 | + documentSelector: |
| 18 | + path: kind |
| 19 | + value: Cluster |
| 20 | + asserts: |
| 21 | + - matchRegex: |
| 22 | + path: spec.imageName |
| 23 | + pattern: ^ghcr\.io/cloudnative-pg/postgresql:18\.[0-9]+$ |
| 24 | + |
| 25 | + - it: postgis flavor switches the Cluster to the standard-trixie PostGIS image |
| 26 | + set: |
| 27 | + flavor: postgis |
| 28 | + templates: |
| 29 | + - templates/db.yaml |
| 30 | + documentSelector: |
| 31 | + path: kind |
| 32 | + value: Cluster |
| 33 | + asserts: |
| 34 | + - matchRegex: |
| 35 | + path: spec.imageName |
| 36 | + pattern: ^ghcr\.io/cloudnative-pg/postgis:18\.[0-9]+-[0-9.]+-standard-trixie$ |
| 37 | + |
| 38 | + - it: postgis flavor runs the init Job from the same image as the Cluster |
| 39 | + set: |
| 40 | + flavor: postgis |
| 41 | + version: v16 |
| 42 | + templates: |
| 43 | + - templates/init-job.yaml |
| 44 | + documentSelector: |
| 45 | + path: kind |
| 46 | + value: Job |
| 47 | + asserts: |
| 48 | + - matchRegex: |
| 49 | + path: spec.template.spec.containers[0].image |
| 50 | + pattern: ^ghcr\.io/cloudnative-pg/postgis:16\.[0-9]+-[0-9.]+-standard-trixie$ |
| 51 | + |
| 52 | + - it: refuses to move a live postgresql cluster to postgis |
| 53 | + set: |
| 54 | + flavor: postgis |
| 55 | + kubernetesProvider: |
| 56 | + scheme: |
| 57 | + "postgresql.cnpg.io/v1/Cluster": |
| 58 | + gvr: |
| 59 | + group: postgresql.cnpg.io |
| 60 | + version: v1 |
| 61 | + resource: clusters |
| 62 | + namespaced: true |
| 63 | + objects: |
| 64 | + - apiVersion: postgresql.cnpg.io/v1 |
| 65 | + kind: Cluster |
| 66 | + metadata: |
| 67 | + name: pg-test |
| 68 | + namespace: tenant-test |
| 69 | + spec: |
| 70 | + imageName: ghcr.io/cloudnative-pg/postgresql:18.1 |
| 71 | + templates: |
| 72 | + - templates/db.yaml |
| 73 | + asserts: |
| 74 | + - failedTemplate: |
| 75 | + errorPattern: "flavor cannot change on an existing cluster \\(running postgresql, requested postgis\\)" |
| 76 | + |
| 77 | + - it: refuses to move a live postgis cluster back to postgresql |
| 78 | + kubernetesProvider: |
| 79 | + scheme: |
| 80 | + "postgresql.cnpg.io/v1/Cluster": |
| 81 | + gvr: |
| 82 | + group: postgresql.cnpg.io |
| 83 | + version: v1 |
| 84 | + resource: clusters |
| 85 | + namespaced: true |
| 86 | + objects: |
| 87 | + - apiVersion: postgresql.cnpg.io/v1 |
| 88 | + kind: Cluster |
| 89 | + metadata: |
| 90 | + name: pg-test |
| 91 | + namespace: tenant-test |
| 92 | + spec: |
| 93 | + imageName: ghcr.io/cloudnative-pg/postgis:18.1-3.6.1-standard-trixie |
| 94 | + templates: |
| 95 | + - templates/db.yaml |
| 96 | + asserts: |
| 97 | + - failedTemplate: |
| 98 | + errorPattern: "flavor cannot change on an existing cluster \\(running postgis, requested postgresql\\)" |
| 99 | + |
| 100 | + - it: lets a live postgis cluster take a new minor from a mirrored, digest-pinned image |
| 101 | + set: |
| 102 | + flavor: postgis |
| 103 | + kubernetesProvider: |
| 104 | + scheme: |
| 105 | + "postgresql.cnpg.io/v1/Cluster": |
| 106 | + gvr: |
| 107 | + group: postgresql.cnpg.io |
| 108 | + version: v1 |
| 109 | + resource: clusters |
| 110 | + namespaced: true |
| 111 | + objects: |
| 112 | + - apiVersion: postgresql.cnpg.io/v1 |
| 113 | + kind: Cluster |
| 114 | + metadata: |
| 115 | + name: pg-test |
| 116 | + namespace: tenant-test |
| 117 | + spec: |
| 118 | + imageName: registry.example:5000/cloudnative-pg/postgis:18.0-3.6.0-standard-trixie@sha256:5a6b6d9016f6de30cd389c8a921b8acb64de0421f125a0ed3e95ce1b978bf169 |
| 119 | + templates: |
| 120 | + - templates/db.yaml |
| 121 | + documentSelector: |
| 122 | + path: kind |
| 123 | + value: Cluster |
| 124 | + asserts: |
| 125 | + - matchRegex: |
| 126 | + path: spec.imageName |
| 127 | + pattern: ^ghcr\.io/cloudnative-pg/postgis:18\. |
| 128 | + |
0 commit comments