From dd137814eee09c6fc277ddb94250ee18fc2f82bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20M=C3=A9sz=C3=A1ros?= Date: Thu, 3 Dec 2026 09:47:47 +0100 Subject: [PATCH] fix(test): wait for ConfigMaps before updating them in MultipleSecondaryEventSourceIT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The initial await used `getNumberOfExecutions() <= 3`, which already holds while the reconciler has not run at all, so it only ever waited for the 300ms poll delay. On a slow runner the first reconciliation had not created the ConfigMaps yet, and updateConfigMap failed with a NullPointerException on the missing ConfigMap. Wait until both ConfigMaps exist before taking the baseline execution count. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Attila Mészáros --- .../MultipleSecondaryEventSourceIT.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/multiplesecondaryeventsource/MultipleSecondaryEventSourceIT.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/multiplesecondaryeventsource/MultipleSecondaryEventSourceIT.java index 678cc74786..66c3571e02 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/multiplesecondaryeventsource/MultipleSecondaryEventSourceIT.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/multiplesecondaryeventsource/MultipleSecondaryEventSourceIT.java @@ -25,6 +25,7 @@ import io.javaoperatorsdk.annotation.Sample; import io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension; +import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; @Sample( @@ -54,6 +55,21 @@ void receivingPeriodicEvents() { var reconciler = operator.getReconcilerOfType(MultipleSecondaryEventSourceReconciler.class); + await() + .untilAsserted( + () -> { + assertThat( + operator.get( + ConfigMap.class, + MultipleSecondaryEventSourceReconciler.getName1(resource))) + .isNotNull(); + assertThat( + operator.get( + ConfigMap.class, + MultipleSecondaryEventSourceReconciler.getName2(resource))) + .isNotNull(); + }); + await().pollDelay(Duration.ofMillis(300)).until(() -> reconciler.getNumberOfExecutions() <= 3); int numberOfInitialExecutions = reconciler.getNumberOfExecutions();