From 8fb7e64041a05ffc6583cc681c6f915b5b67732d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20M=C3=A9sz=C3=A1ros?= Date: Wed, 24 Jun 2026 09:27:47 +0200 Subject: [PATCH 1/2] fix: de-flake LatestDistinctIT.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Attila Mészáros --- .../latestdistinct/LatestDistinctIT.java | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/latestdistinct/LatestDistinctIT.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/latestdistinct/LatestDistinctIT.java index 24cee17f04..124124796e 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/latestdistinct/LatestDistinctIT.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/latestdistinct/LatestDistinctIT.java @@ -76,10 +76,28 @@ void testLatestDistinctListWithTwoInformerEventSources() { // Should see 1 distinct ConfigMaps assertThat(updatedResource.getStatus().getConfigMapCount()).isEqualTo(1); assertThat(reconciler.isErrorOccurred()).isFalse(); - // note that since there are two event source, and we do the update through one event - // source - // the other will still propagate an event - assertThat(reconciler.getNumberOfExecutions()).isEqualTo(2); + // Since there are two event sources and we do the update through one of them, the + // other source still propagates an event, triggering at least a second + // reconciliation. The exact count is not asserted: the initial ADDED event fires from + // both informers and only usually coalesces into a single reconciliation, so an + // occasional extra reconciliation is an expected, benign event-coalescing race. + assertThat(reconciler.getNumberOfExecutions()).isGreaterThanOrEqualTo(2); + }); + + // Stabilization check: with correct own-update filtering the reconciler's own ConfigMap update + // must not trigger a fresh reconciliation, so the execution count has to settle. A runaway + // reconcile loop (filtering broken) would keep incrementing it. We allow one in-flight + // reconciliation past the baseline but require the count to stop growing over the window. + int executionsBaseline = reconciler.getNumberOfExecutions(); + await() + .during(Duration.ofSeconds(2)) + .atMost(Duration.ofSeconds(3)) + .untilAsserted( + () -> { + assertThat(reconciler.isErrorOccurred()).isFalse(); + assertThat(reconciler.getNumberOfExecutions()) + .as("reconciliation count must stabilize, not loop") + .isLessThanOrEqualTo(executionsBaseline + 1); }); } From 0347ea71da186df6c29058e81aabfec0a289d733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20M=C3=A9sz=C3=A1ros?= Date: Wed, 24 Jun 2026 09:37:36 +0200 Subject: [PATCH 2/2] Potential fix for pull request finding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Attila Mészáros --- .../operator/baseapi/latestdistinct/LatestDistinctIT.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/latestdistinct/LatestDistinctIT.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/latestdistinct/LatestDistinctIT.java index 124124796e..757a663daa 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/latestdistinct/LatestDistinctIT.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/latestdistinct/LatestDistinctIT.java @@ -84,9 +84,9 @@ void testLatestDistinctListWithTwoInformerEventSources() { assertThat(reconciler.getNumberOfExecutions()).isGreaterThanOrEqualTo(2); }); - // Stabilization check: with correct own-update filtering the reconciler's own ConfigMap update - // must not trigger a fresh reconciliation, so the execution count has to settle. A runaway - // reconcile loop (filtering broken) would keep incrementing it. We allow one in-flight + // Stabilization check: own-update filtering must prevent the reconciler's ConfigMap update from + // causing an unbounded reconciliation loop, so the execution count has to settle. + // A runaway loop (filtering broken) would keep incrementing it. We allow one in-flight // reconciliation past the baseline but require the count to stop growing over the window. int executionsBaseline = reconciler.getNumberOfExecutions(); await()