Skip to content

Commit 9a106b9

Browse files
committed
Update tests to conform to new kubernetes packages
1 parent c280282 commit 9a106b9

6 files changed

Lines changed: 111 additions & 16 deletions

File tree

internal/controller/pgupgrade/jobs_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ kind: Job
165165
metadata:
166166
annotations:
167167
kubectl.kubernetes.io/default-container: database
168-
creationTimestamp: null
169168
labels:
170169
postgres-operator.crunchydata.com/cluster: pg5
171170
postgres-operator.crunchydata.com/pgupgrade: pgu2
@@ -186,7 +185,6 @@ spec:
186185
metadata:
187186
annotations:
188187
kubectl.kubernetes.io/default-container: database
189-
creationTimestamp: null
190188
labels:
191189
postgres-operator.crunchydata.com/cluster: pg5
192190
postgres-operator.crunchydata.com/pgupgrade: pgu2
@@ -310,7 +308,6 @@ kind: Job
310308
metadata:
311309
annotations:
312310
kubectl.kubernetes.io/default-container: database
313-
creationTimestamp: null
314311
labels:
315312
postgres-operator.crunchydata.com/cluster: pg5
316313
postgres-operator.crunchydata.com/pgupgrade: pgu2
@@ -330,7 +327,6 @@ spec:
330327
metadata:
331328
annotations:
332329
kubectl.kubernetes.io/default-container: database
333-
creationTimestamp: null
334330
labels:
335331
postgres-operator.crunchydata.com/cluster: pg5
336332
postgres-operator.crunchydata.com/pgupgrade: pgu2

internal/controller/postgrescluster/pgadmin_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ apiVersion: v1
7070
kind: ConfigMap
7171
`))
7272
assert.Assert(t, cmp.MarshalMatches(configmap.ObjectMeta, `
73-
creationTimestamp: null
7473
labels:
7574
postgres-operator.crunchydata.com/cluster: pg1
7675
postgres-operator.crunchydata.com/role: pgadmin

internal/controller/standalone_pgadmin/configmap_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ apiVersion: v1
213213
kind: ConfigMap
214214
`))
215215
assert.Assert(t, cmp.MarshalMatches(configmap.ObjectMeta, `
216-
creationTimestamp: null
217216
labels:
218217
postgres-operator.crunchydata.com/pgadmin: pg1
219218
postgres-operator.crunchydata.com/role: pgadmin

internal/controller/standalone_pgadmin/service_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ kind: Service
3939
assert.Assert(t, cmp.MarshalMatches(service.ObjectMeta, `
4040
annotations:
4141
test-annotation: test-annotation-val
42-
creationTimestamp: null
4342
labels:
4443
postgres-operator.crunchydata.com/pgadmin: daisy
4544
postgres-operator.crunchydata.com/role: pgadmin

internal/postgres/reconcile_test.go

Lines changed: 109 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,11 +725,63 @@ volumes:
725725
// NOTE: `creationTimestamp: null` appears in the resulting pod,
726726
// but it does not affect the PVC or reconciliation events;
727727
// possibly https://pr.k8s.io/100032
728-
assert.Assert(t, cmp.MarshalContains(pod.Spec.Volumes, `
728+
assert.Assert(t, cmp.MarshalContains(pod.Spec.Volumes, `- name: cert-volume
729+
projected:
730+
defaultMode: 384
731+
sources:
732+
- secret:
733+
items:
734+
- key: tls.crt
735+
path: tls.crt
736+
- key: tls.key
737+
path: tls.key
738+
- key: ca.crt
739+
path: ca.crt
740+
name: srv-secret
741+
- secret:
742+
items:
743+
- key: tls.crt
744+
path: replication/tls.crt
745+
- key: tls.key
746+
path: replication/tls.key
747+
name: repl-secret
748+
- name: postgres-data
749+
persistentVolumeClaim:
750+
claimName: datavol
751+
- downwardAPI:
752+
items:
753+
- path: cpu_limit
754+
resourceFieldRef:
755+
containerName: database
756+
divisor: "0"
757+
resource: limits.cpu
758+
- path: cpu_request
759+
resourceFieldRef:
760+
containerName: database
761+
divisor: "0"
762+
resource: requests.cpu
763+
- path: mem_limit
764+
resourceFieldRef:
765+
containerName: database
766+
divisor: "0"
767+
resource: limits.memory
768+
- path: mem_request
769+
resourceFieldRef:
770+
containerName: database
771+
divisor: "0"
772+
resource: requests.memory
773+
- fieldRef:
774+
apiVersion: v1
775+
fieldPath: metadata.labels
776+
path: labels
777+
- fieldRef:
778+
apiVersion: v1
779+
fieldPath: metadata.annotations
780+
path: annotations
781+
name: database-containerinfo
729782
- ephemeral:
730783
volumeClaimTemplate:
731-
metadata:
732-
creationTimestamp: null
784+
metadata: {}
733785
spec:
734786
resources:
735787
requests:
@@ -746,13 +798,65 @@ volumes:
746798
InstancePod(ctx, cluster, instance,
747799
serverSecretProjection, clientSecretProjection, dataVolume, nil, nil, annotated)
748800

749-
assert.Assert(t, cmp.MarshalContains(annotated.Spec.Volumes, `
801+
assert.Assert(t, cmp.MarshalContains(annotated.Spec.Volumes, `- name: cert-volume
802+
projected:
803+
defaultMode: 384
804+
sources:
805+
- secret:
806+
items:
807+
- key: tls.crt
808+
path: tls.crt
809+
- key: tls.key
810+
path: tls.key
811+
- key: ca.crt
812+
path: ca.crt
813+
name: srv-secret
814+
- secret:
815+
items:
816+
- key: tls.crt
817+
path: replication/tls.crt
818+
- key: tls.key
819+
path: replication/tls.key
820+
name: repl-secret
821+
- name: postgres-data
822+
persistentVolumeClaim:
823+
claimName: datavol
824+
- downwardAPI:
825+
items:
826+
- path: cpu_limit
827+
resourceFieldRef:
828+
containerName: database
829+
divisor: "0"
830+
resource: limits.cpu
831+
- path: cpu_request
832+
resourceFieldRef:
833+
containerName: database
834+
divisor: "0"
835+
resource: requests.cpu
836+
- path: mem_limit
837+
resourceFieldRef:
838+
containerName: database
839+
divisor: "0"
840+
resource: limits.memory
841+
- path: mem_request
842+
resourceFieldRef:
843+
containerName: database
844+
divisor: "0"
845+
resource: requests.memory
846+
- fieldRef:
847+
apiVersion: v1
848+
fieldPath: metadata.labels
849+
path: labels
850+
- fieldRef:
851+
apiVersion: v1
852+
fieldPath: metadata.annotations
853+
path: annotations
854+
name: database-containerinfo
750855
- ephemeral:
751856
volumeClaimTemplate:
752857
metadata:
753858
annotations:
754859
n1: etc
755-
creationTimestamp: null
756860
labels:
757861
gg: asdf
758862
spec:

pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ func TestPostgresClusterDefault(t *testing.T) {
3131
assert.DeepEqual(t, string(b), strings.TrimSpace(`
3232
apiVersion: postgres-operator.crunchydata.com/v1beta1
3333
kind: PostgresCluster
34-
metadata:
35-
creationTimestamp: null
34+
metadata: {}
3635
spec:
3736
backups:
3837
pgbackrest:
@@ -63,8 +62,7 @@ status:
6362
assert.DeepEqual(t, string(b), strings.TrimSpace(`
6463
apiVersion: postgres-operator.crunchydata.com/v1beta1
6564
kind: PostgresCluster
66-
metadata:
67-
creationTimestamp: null
65+
metadata: {}
6866
spec:
6967
backups:
7068
pgbackrest:

0 commit comments

Comments
 (0)