Skip to content

Commit

Permalink
Add tests for custom image name key overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
allenporter committed Mar 3, 2025
1 parent 5096863 commit 71f0fb9
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
CWD / "tests/testdata/cluster7",
{},
),
(
CWD / "tests/testdata/cluster",
{
"flux-system/infra-configs": {
"ceph/ceph:v16.2.6",
"ghcr.io/cloudnative-pg/postgis:17-3.4",
},
},
)
],
)
async def test_image_visitor(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: ceph.rook.io/v1
kind: CephCluster
metadata:
name: rook-ceph
namespace: rook-ceph
spec:
cephVersion:
image: ceph/ceph:v16.2.6
18 changes: 18 additions & 0 deletions tests/testdata/cluster/infrastructure/configs/database.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-example
spec:
instances: 3
imageName: ghcr.io/cloudnative-pg/postgis:17-3.4
bootstrap:
initdb:
postInitTemplateSQL:
- CREATE EXTENSION postgis;
- CREATE EXTENSION postgis_topology;
- CREATE EXTENSION fuzzystrmatch;
- CREATE EXTENSION postgis_tiger_geocoder;

storage:
size: 1Gi
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ kind: Kustomization
resources:
- cluster-policies.yaml
- helm-repositories.yaml
- ceph-cluster.yaml
- database.yaml
114 changes: 114 additions & 0 deletions tests/tool/__snapshots__/test_build.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -3202,6 +3202,44 @@
interval: 120m
type: oci
url: oci://ghcr.io/weaveworks/charts
---
apiVersion: ceph.rook.io/v1
kind: CephCluster
metadata:
labels:
kustomize.toolkit.fluxcd.io/name: infra-configs
kustomize.toolkit.fluxcd.io/namespace: flux-system
name: rook-ceph
namespace: rook-ceph
annotations:
config.kubernetes.io/index: '4'
internal.config.kubernetes.io/index: '4'
spec:
cephVersion:
image: ceph/ceph:v16.2.6
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
labels:
kustomize.toolkit.fluxcd.io/name: infra-configs
kustomize.toolkit.fluxcd.io/namespace: flux-system
name: cluster-example
annotations:
config.kubernetes.io/index: '5'
internal.config.kubernetes.io/index: '5'
spec:
bootstrap:
initdb:
postInitTemplateSQL:
- CREATE EXTENSION postgis;
- CREATE EXTENSION postgis_topology;
- CREATE EXTENSION fuzzystrmatch;
- CREATE EXTENSION postgis_tiger_geocoder;
imageName: ghcr.io/cloudnative-pg/postgis:17-3.4
instances: 3
storage:
size: 1Gi

---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
Expand Down Expand Up @@ -4987,6 +5025,44 @@
interval: 120m
type: oci
url: oci://ghcr.io/weaveworks/charts
---
apiVersion: ceph.rook.io/v1
kind: CephCluster
metadata:
labels:
kustomize.toolkit.fluxcd.io/name: infra-configs
kustomize.toolkit.fluxcd.io/namespace: flux-system
name: rook-ceph
namespace: rook-ceph
annotations:
config.kubernetes.io/index: '4'
internal.config.kubernetes.io/index: '4'
spec:
cephVersion:
image: ceph/ceph:v16.2.6
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
labels:
kustomize.toolkit.fluxcd.io/name: infra-configs
kustomize.toolkit.fluxcd.io/namespace: flux-system
name: cluster-example
annotations:
config.kubernetes.io/index: '5'
internal.config.kubernetes.io/index: '5'
spec:
bootstrap:
initdb:
postInitTemplateSQL:
- CREATE EXTENSION postgis;
- CREATE EXTENSION postgis_topology;
- CREATE EXTENSION fuzzystrmatch;
- CREATE EXTENSION postgis_tiger_geocoder;
imageName: ghcr.io/cloudnative-pg/postgis:17-3.4
instances: 3
storage:
size: 1Gi

---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
Expand Down Expand Up @@ -7037,6 +7113,44 @@
interval: 120m
type: oci
url: oci://ghcr.io/weaveworks/charts
---
apiVersion: ceph.rook.io/v1
kind: CephCluster
metadata:
labels:
kustomize.toolkit.fluxcd.io/name: infra-configs
kustomize.toolkit.fluxcd.io/namespace: flux-system
name: rook-ceph
namespace: rook-ceph
annotations:
config.kubernetes.io/index: '4'
internal.config.kubernetes.io/index: '4'
spec:
cephVersion:
image: ceph/ceph:v16.2.6
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
labels:
kustomize.toolkit.fluxcd.io/name: infra-configs
kustomize.toolkit.fluxcd.io/namespace: flux-system
name: cluster-example
annotations:
config.kubernetes.io/index: '5'
internal.config.kubernetes.io/index: '5'
spec:
bootstrap:
initdb:
postInitTemplateSQL:
- CREATE EXTENSION postgis;
- CREATE EXTENSION postgis_topology;
- CREATE EXTENSION fuzzystrmatch;
- CREATE EXTENSION postgis_tiger_geocoder;
imageName: ghcr.io/cloudnative-pg/postgis:17-3.4
instances: 3
storage:
size: 1Gi

---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
Expand Down
3 changes: 3 additions & 0 deletions tests/tool/__snapshots__/test_get_cluster.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
helm_releases: []
config_maps: []
secrets: []
images:
- ceph/ceph:v16.2.6
- ghcr.io/cloudnative-pg/postgis:17-3.4
- name: infra-controllers
namespace: flux-system
path: tests/testdata/cluster/infrastructure/controllers
Expand Down

0 comments on commit 71f0fb9

Please sign in to comment.