(t *testing.T)
| 155 | } |
| 156 | |
| 157 | func TestPodAnnotationsSync(t *testing.T) { |
| 158 | clusterName := "acid-test-cluster-2" |
| 159 | namespace := "default" |
| 160 | podAnnotation := "no-scale-down" |
| 161 | podAnnotations := map[string]string{podAnnotation: "true"} |
| 162 | customPodAnnotation := "foo" |
| 163 | customPodAnnotations := map[string]string{customPodAnnotation: "true"} |
| 164 | |
| 165 | ctrl := gomock.NewController(t) |
| 166 | defer ctrl.Finish() |
| 167 | mockClient := mocks.NewMockHTTPClient(ctrl) |
| 168 | client, _ := newFakeK8sAnnotationsClient() |
| 169 | |
| 170 | pg := acidv1.Postgresql{ |
| 171 | ObjectMeta: metav1.ObjectMeta{ |
| 172 | Name: clusterName, |
| 173 | Namespace: namespace, |
| 174 | }, |
| 175 | Spec: acidv1.PostgresSpec{ |
| 176 | Volume: acidv1.Volume{ |
| 177 | Size: "1Gi", |
| 178 | }, |
| 179 | EnableConnectionPooler: boolToPointer(true), |
| 180 | EnableLogicalBackup: true, |
| 181 | EnableReplicaConnectionPooler: boolToPointer(true), |
| 182 | PodAnnotations: podAnnotations, |
| 183 | NumberOfInstances: 2, |
| 184 | }, |
| 185 | } |
| 186 | |
| 187 | var cluster = New( |
| 188 | Config{ |
| 189 | OpConfig: config.Config{ |
| 190 | PatroniAPICheckInterval: time.Duration(1), |
| 191 | PatroniAPICheckTimeout: time.Duration(5), |
| 192 | PodManagementPolicy: "ordered_ready", |
| 193 | CustomPodAnnotations: customPodAnnotations, |
| 194 | ConnectionPooler: config.ConnectionPooler{ |
| 195 | ConnectionPoolerDefaultCPURequest: "100m", |
| 196 | ConnectionPoolerDefaultCPULimit: "100m", |
| 197 | ConnectionPoolerDefaultMemoryRequest: "100Mi", |
| 198 | ConnectionPoolerDefaultMemoryLimit: "100Mi", |
| 199 | NumberOfInstances: k8sutil.Int32ToPointer(1), |
| 200 | }, |
| 201 | Resources: config.Resources{ |
| 202 | ClusterLabels: map[string]string{"application": "spilo"}, |
| 203 | ClusterNameLabel: "cluster-name", |
| 204 | DefaultCPURequest: "300m", |
| 205 | DefaultCPULimit: "300m", |
| 206 | DefaultMemoryRequest: "300Mi", |
| 207 | DefaultMemoryLimit: "300Mi", |
| 208 | MaxInstances: -1, |
| 209 | PodRoleLabel: "spilo-role", |
| 210 | ResourceCheckInterval: time.Duration(3), |
| 211 | ResourceCheckTimeout: time.Duration(10), |
| 212 | }, |
| 213 | }, |
| 214 | }, client, pg, logger, eventRecorder) |
nothing calls this directly
no test coverage detected