@@ -24,49 +24,7 @@ func TestGetPrimaryPod(t *testing.T) {
2424 expectedError string
2525 expectedPod string
2626 }{
27- "patroni 4.1.0 with annotation" : {
28- cr : & v2.PerconaPGCluster {
29- Spec : v2.PerconaPGClusterSpec {
30- CRVersion : version .Version (),
31- },
32- ObjectMeta : metav1.ObjectMeta {
33- Name : "test-cluster" ,
34- Namespace : "test-namespace" ,
35- Annotations : map [string ]string {
36- pNaming .AnnotationPatroniVersion : "4.1.0" ,
37- },
38- },
39- Status : v2.PerconaPGClusterStatus {
40- Patroni : v2.Patroni {
41- Version : "4.0.0" ,
42- },
43- },
44- },
45- pods : []corev1.Pod {
46- {
47- ObjectMeta : metav1.ObjectMeta {
48- Name : "test-cluster-primary-0" ,
49- Namespace : "test-namespace" ,
50- Labels : map [string ]string {
51- "app.kubernetes.io/instance" : "test-cluster" ,
52- "postgres-operator.crunchydata.com/role" : "primary" ,
53- },
54- },
55- },
56- {
57- ObjectMeta : metav1.ObjectMeta {
58- Name : "test-cluster-primary-1" ,
59- Namespace : "test-namespace" ,
60- Labels : map [string ]string {
61- "app.kubernetes.io/instance" : "test-cluster" ,
62- "postgres-operator.crunchydata.com/role" : "something" ,
63- },
64- },
65- },
66- },
67- expectedPod : "test-cluster-primary-0" ,
68- },
69- "patroni 4.0.0 without annotation" : {
27+ "patroni 4.0.0" : {
7028 cr : & v2.PerconaPGCluster {
7129 Spec : v2.PerconaPGClusterSpec {
7230 CRVersion : version .Version (),
@@ -132,74 +90,6 @@ func TestGetPrimaryPod(t *testing.T) {
13290 },
13391 expectedPod : "test-cluster-master-0" ,
13492 },
135- "patroni version from annotation overrides status for version >= 2.8.0" : {
136- cr : & v2.PerconaPGCluster {
137- ObjectMeta : metav1.ObjectMeta {
138- Name : "test-cluster" ,
139- Namespace : "test-namespace" ,
140- Annotations : map [string ]string {
141- pNaming .AnnotationPatroniVersion : "4.1.0" ,
142- },
143- },
144- Spec : v2.PerconaPGClusterSpec {
145- PostgresVersion : 16 ,
146- CRVersion : version .Version (),
147- },
148- Status : v2.PerconaPGClusterStatus {
149- PatroniVersion : "3.0.0" ,
150- Postgres : v2.PostgresStatus {
151- Version : 16 ,
152- },
153- },
154- },
155- pods : []corev1.Pod {
156- {
157- ObjectMeta : metav1.ObjectMeta {
158- Name : "test-cluster-primary-0" ,
159- Namespace : "test-namespace" ,
160- Labels : map [string ]string {
161- "app.kubernetes.io/instance" : "test-cluster" ,
162- "postgres-operator.crunchydata.com/role" : "primary" ,
163- },
164- },
165- },
166- },
167- expectedPod : "test-cluster-primary-0" ,
168- },
169- "patroni version from status used for version < 2.8.0" : {
170- cr : & v2.PerconaPGCluster {
171- ObjectMeta : metav1.ObjectMeta {
172- Name : "test-cluster" ,
173- Namespace : "test-namespace" ,
174- Annotations : map [string ]string {
175- pNaming .AnnotationPatroniVersion : "4.0.0" ,
176- },
177- },
178- Spec : v2.PerconaPGClusterSpec {
179- PostgresVersion : 14 ,
180- CRVersion : "2.7.0" ,
181- },
182- Status : v2.PerconaPGClusterStatus {
183- PatroniVersion : "3.0.0" ,
184- Postgres : v2.PostgresStatus {
185- Version : 14 ,
186- },
187- },
188- },
189- pods : []corev1.Pod {
190- {
191- ObjectMeta : metav1.ObjectMeta {
192- Name : "test-cluster-master-0" ,
193- Namespace : "test-namespace" ,
194- Labels : map [string ]string {
195- "app.kubernetes.io/instance" : "test-cluster" ,
196- "postgres-operator.crunchydata.com/role" : "master" ,
197- },
198- },
199- },
200- },
201- expectedPod : "test-cluster-master-0" ,
202- },
20393 "no primary pod found" : {
20494 cr : & v2.PerconaPGCluster {
20595 ObjectMeta : metav1.ObjectMeta {
0 commit comments