@@ -36,6 +36,7 @@ import (
36
36
37
37
"github.com/crunchydata/postgres-operator/internal/initialize"
38
38
"github.com/crunchydata/postgres-operator/internal/naming"
39
+ "github.com/crunchydata/postgres-operator/internal/testing/cmp"
39
40
"github.com/crunchydata/postgres-operator/internal/testing/require"
40
41
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
41
42
)
@@ -611,11 +612,11 @@ func TestGenerateClusterPrimaryService(t *testing.T) {
611
612
assert .ErrorContains (t , err , "not implemented" )
612
613
613
614
alwaysExpect := func (t testing.TB , service * corev1.Service , endpoints * corev1.Endpoints ) {
614
- assert .Assert (t , marshalMatches (service .TypeMeta , `
615
+ assert .Assert (t , cmp . MarshalMatches (service .TypeMeta , `
615
616
apiVersion: v1
616
617
kind: Service
617
618
` ))
618
- assert .Assert (t , marshalMatches (service .ObjectMeta , `
619
+ assert .Assert (t , cmp . MarshalMatches (service .ObjectMeta , `
619
620
creationTimestamp: null
620
621
labels:
621
622
postgres-operator.crunchydata.com/cluster: pg5
@@ -630,7 +631,7 @@ ownerReferences:
630
631
name: pg5
631
632
uid: ""
632
633
` ))
633
- assert .Assert (t , marshalMatches (service .Spec .Ports , `
634
+ assert .Assert (t , cmp . MarshalMatches (service .Spec .Ports , `
634
635
- name: postgres
635
636
port: 2600
636
637
protocol: TCP
@@ -641,7 +642,7 @@ ownerReferences:
641
642
assert .Assert (t , service .Spec .Selector == nil ,
642
643
"got %v" , service .Spec .Selector )
643
644
644
- assert .Assert (t , marshalMatches (endpoints , `
645
+ assert .Assert (t , cmp . MarshalMatches (endpoints , `
645
646
apiVersion: v1
646
647
kind: Endpoints
647
648
metadata:
@@ -730,11 +731,11 @@ func TestGenerateClusterReplicaServiceIntent(t *testing.T) {
730
731
assert .NilError (t , err )
731
732
732
733
alwaysExpect := func (t testing.TB , service * corev1.Service ) {
733
- assert .Assert (t , marshalMatches (service .TypeMeta , `
734
+ assert .Assert (t , cmp . MarshalMatches (service .TypeMeta , `
734
735
apiVersion: v1
735
736
kind: Service
736
737
` ))
737
- assert .Assert (t , marshalMatches (service .ObjectMeta , `
738
+ assert .Assert (t , cmp . MarshalMatches (service .ObjectMeta , `
738
739
creationTimestamp: null
739
740
labels:
740
741
postgres-operator.crunchydata.com/cluster: pg2
@@ -752,7 +753,7 @@ ownerReferences:
752
753
}
753
754
754
755
alwaysExpect (t , service )
755
- assert .Assert (t , marshalMatches (service .Spec , `
756
+ assert .Assert (t , cmp . MarshalMatches (service .Spec , `
756
757
ports:
757
758
- name: postgres
758
759
port: 9876
@@ -788,7 +789,7 @@ type: ClusterIP
788
789
assert .NilError (t , err )
789
790
alwaysExpect (t , service )
790
791
test .Expect (t , service )
791
- assert .Assert (t , marshalMatches (service .Spec .Ports , `
792
+ assert .Assert (t , cmp . MarshalMatches (service .Spec .Ports , `
792
793
- name: postgres
793
794
port: 9876
794
795
protocol: TCP
@@ -808,19 +809,19 @@ type: ClusterIP
808
809
assert .NilError (t , err )
809
810
810
811
// Annotations present in the metadata.
811
- assert .Assert (t , marshalMatches (service .ObjectMeta .Annotations , `
812
+ assert .Assert (t , cmp . MarshalMatches (service .ObjectMeta .Annotations , `
812
813
some: note
813
814
` ))
814
815
815
816
// Labels present in the metadata.
816
- assert .Assert (t , marshalMatches (service .ObjectMeta .Labels , `
817
+ assert .Assert (t , cmp . MarshalMatches (service .ObjectMeta .Labels , `
817
818
happy: label
818
819
postgres-operator.crunchydata.com/cluster: pg2
819
820
postgres-operator.crunchydata.com/role: replica
820
821
` ))
821
822
822
823
// Labels not in the selector.
823
- assert .Assert (t , marshalMatches (service .Spec .Selector , `
824
+ assert .Assert (t , cmp . MarshalMatches (service .Spec .Selector , `
824
825
postgres-operator.crunchydata.com/cluster: pg2
825
826
postgres-operator.crunchydata.com/role: replica
826
827
` ))
0 commit comments