|
5 | 5 | package io.strimzi.operator.cluster.operator.assembly; |
6 | 6 |
|
7 | 7 | import io.fabric8.kubernetes.api.model.ConfigMap; |
| 8 | +import io.fabric8.kubernetes.api.model.ConfigMapBuilder; |
8 | 9 | import io.fabric8.kubernetes.api.model.LabelSelector; |
9 | 10 | import io.fabric8.kubernetes.api.model.Service; |
10 | 11 | import io.fabric8.kubernetes.api.model.apps.Deployment; |
@@ -143,6 +144,8 @@ public void testCreateOrUpdateCreatesCluster(VertxTestContext context) { |
143 | 144 | when(mockPdbOps.reconcile(any(), anyString(), any(), pdbCaptor.capture())).thenReturn(Future.succeededFuture()); |
144 | 145 |
|
145 | 146 | when(mockCmOps.reconcile(any(), anyString(), any(), any())).thenReturn(Future.succeededFuture()); |
| 147 | + // Metrics configuration map |
| 148 | + when(mockCmOps.getAsync(any(), eq("my-metrics-config"))).thenReturn(Future.succeededFuture(new ConfigMapBuilder().withData(Map.of("metrics.yaml", "metrics-config")).build())); |
146 | 149 |
|
147 | 150 | ArgumentCaptor<KafkaBridge> bridgeCaptor = ArgumentCaptor.forClass(KafkaBridge.class); |
148 | 151 | when(mockBridgeOps.updateStatusAsync(any(), bridgeCaptor.capture())).thenReturn(Future.succeededFuture()); |
@@ -171,7 +174,7 @@ public void testCreateOrUpdateCreatesCluster(VertxTestContext context) { |
171 | 174 | assertThat(dc.getMetadata().getName(), is(bridge.getComponentName())); |
172 | 175 | assertThat(dc, is(bridge.generateDeployment(Map.of( |
173 | 176 | Annotations.ANNO_STRIMZI_AUTH_HASH, "0", |
174 | | - Annotations.ANNO_STRIMZI_IO_CONFIGURATION_HASH, "eeacc2f1" |
| 177 | + Annotations.ANNO_STRIMZI_IO_CONFIGURATION_HASH, "9fd6bb72" |
175 | 178 | ), true, null, null))); |
176 | 179 |
|
177 | 180 | // Verify PodDisruptionBudget |
@@ -239,6 +242,9 @@ public void testCreateOrUpdateWithNoDiffCausesNoChanges(VertxTestContext context |
239 | 242 | when(mockPdbOps.reconcile(any(), anyString(), any(), pdbCaptor.capture())).thenReturn(Future.succeededFuture()); |
240 | 243 |
|
241 | 244 | when(mockCmOps.reconcile(any(), anyString(), any(), any())).thenReturn(Future.succeededFuture(ReconcileResult.created(new ConfigMap()))); |
| 245 | + // Metrics configuration map |
| 246 | + when(mockCmOps.getAsync(any(), eq("my-metrics-config"))).thenReturn(Future.succeededFuture(new ConfigMapBuilder().withData(Map.of("metrics.yaml", "metrics-config")).build())); |
| 247 | + |
242 | 248 | KafkaBridgeAssemblyOperator ops = new KafkaBridgeAssemblyOperator(vertx, |
243 | 249 | new PlatformFeaturesAvailability(true, kubernetesVersion), |
244 | 250 | new MockCertManager(), new PasswordGenerator(10, "a", "a"), |
@@ -317,6 +323,8 @@ public void testCreateOrUpdateUpdatesCluster(VertxTestContext context) { |
317 | 323 | when(mockPdbOps.reconcile(any(), anyString(), any(), pdbCaptor.capture())).thenReturn(Future.succeededFuture()); |
318 | 324 |
|
319 | 325 | when(mockCmOps.reconcile(any(), anyString(), any(), any())).thenReturn(Future.succeededFuture()); |
| 326 | + // Metrics configuration map |
| 327 | + when(mockCmOps.getAsync(any(), eq("my-metrics-config"))).thenReturn(Future.succeededFuture(new ConfigMapBuilder().withData(Map.of("metrics.yaml", "metrics-config")).build())); |
320 | 328 |
|
321 | 329 | KafkaBridgeAssemblyOperator ops = new KafkaBridgeAssemblyOperator(vertx, |
322 | 330 | new PlatformFeaturesAvailability(true, kubernetesVersion), |
@@ -344,7 +352,7 @@ public void testCreateOrUpdateUpdatesCluster(VertxTestContext context) { |
344 | 352 | assertThat(dc.getMetadata().getName(), is(compareTo.getComponentName())); |
345 | 353 | assertThat(dc, is(compareTo.generateDeployment(Map.of( |
346 | 354 | Annotations.ANNO_STRIMZI_AUTH_HASH, "0", |
347 | | - Annotations.ANNO_STRIMZI_IO_CONFIGURATION_HASH, "eeacc2f1" |
| 355 | + Annotations.ANNO_STRIMZI_IO_CONFIGURATION_HASH, "9fd6bb72" |
348 | 356 | ), true, null, null))); |
349 | 357 |
|
350 | 358 | // Verify PodDisruptionBudget |
@@ -707,15 +715,22 @@ public void testCreateOrUpdateBridgeZeroReplica(VertxTestContext context) { |
707 | 715 | when(mockBridgeOps.get(kbNamespace, kbName)).thenReturn(kb); |
708 | 716 | when(mockBridgeOps.getAsync(anyString(), anyString())).thenReturn(Future.succeededFuture(kb)); |
709 | 717 | when(mockBridgeOps.get(anyString(), anyString())).thenReturn(kb); |
| 718 | + ArgumentCaptor<KafkaBridge> bridgeCaptor = ArgumentCaptor.forClass(KafkaBridge.class); |
| 719 | + when(mockBridgeOps.updateStatusAsync(any(), bridgeCaptor.capture())).thenReturn(Future.succeededFuture()); |
| 720 | + |
710 | 721 | when(mockServiceOps.reconcile(any(), anyString(), anyString(), any())).thenReturn(Future.succeededFuture()); |
| 722 | + |
711 | 723 | when(mockDcOps.reconcile(any(), anyString(), anyString(), any())).thenReturn(Future.succeededFuture()); |
712 | 724 | when(mockDcOps.scaleUp(any(), anyString(), anyString(), anyInt(), anyLong())).thenReturn(Future.succeededFuture(42)); |
713 | 725 | when(mockDcOps.scaleDown(any(), anyString(), anyString(), anyInt(), anyLong())).thenReturn(Future.succeededFuture(42)); |
714 | 726 | when(mockDcOps.waitForObserved(any(), anyString(), anyString(), anyLong(), anyLong())).thenReturn(Future.succeededFuture()); |
| 727 | + |
715 | 728 | when(mockPdbOps.reconcile(any(), anyString(), any(), any())).thenReturn(Future.succeededFuture()); |
| 729 | + |
716 | 730 | when(mockCmOps.reconcile(any(), anyString(), any(), any())).thenReturn(Future.succeededFuture(ReconcileResult.created(new ConfigMap()))); |
717 | | - ArgumentCaptor<KafkaBridge> bridgeCaptor = ArgumentCaptor.forClass(KafkaBridge.class); |
718 | | - when(mockBridgeOps.updateStatusAsync(any(), bridgeCaptor.capture())).thenReturn(Future.succeededFuture()); |
| 731 | + // Metrics configuration map |
| 732 | + when(mockCmOps.getAsync(any(), eq("my-metrics-config"))).thenReturn(Future.succeededFuture(new ConfigMapBuilder().withData(Map.of("metrics.yaml", "metrics-config")).build())); |
| 733 | + |
719 | 734 | KafkaBridgeAssemblyOperator ops = new KafkaBridgeAssemblyOperator(vertx, |
720 | 735 | new PlatformFeaturesAvailability(true, kubernetesVersion), |
721 | 736 | new MockCertManager(), new PasswordGenerator(10, "a", "a"), |
|
0 commit comments