From 6cf714a56010c2e977d63bdbd14fdd0c647209de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20M=C3=A9sz=C3=A1ros?= Date: Fri, 19 Jun 2026 10:57:18 +0200 Subject: [PATCH 1/2] test: fix flaky additionalFinalizer in TriggerReconcilerOnAllEventIT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The phase-1 await could pass prematurely: right after create() the resource already has exactly [ADDITIONAL_FINALIZER], before the operator adds its own FINALIZER. This snapshotted a stale event count, so the phase-2 isEqualTo(eventCount + 1) assertion against a monotonic counter would overshoot and time out. Wait for the operator to add its own finalizer before deleting, so phase 1 reflects the completed add/mark-for-deletion/remove cycle and the baseline is deterministic. Co-Authored-By: Claude Opus 4.8 (1M context) Signed-off-by: Attila Mészáros --- .../eventing/TriggerReconcilerOnAllEventIT.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/triggerallevent/eventing/TriggerReconcilerOnAllEventIT.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/triggerallevent/eventing/TriggerReconcilerOnAllEventIT.java index 3bb0b539c0..e0d25afedf 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/triggerallevent/eventing/TriggerReconcilerOnAllEventIT.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/triggerallevent/eventing/TriggerReconcilerOnAllEventIT.java @@ -130,6 +130,16 @@ void additionalFinalizer() { extension.create(res); + // Wait until the operator has added its own finalizer before deleting. Right after create the + // resource already has exactly [ADDITIONAL_FINALIZER], so without this the assertion below could + // pass prematurely (before the add/mark-for-deletion/remove cycle), snapshotting a stale event + // count and making the phase-2 `eventCount + 1` assertion flaky. + await() + .untilAsserted( + () -> + assertThat(getResource().getMetadata().getFinalizers()) + .containsExactlyInAnyOrder(ADDITIONAL_FINALIZER, FINALIZER)); + extension.delete(getResource()); await() From bc13f81d1f40fefec8ee18cbab2aa30c440776c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20M=C3=A9sz=C3=A1ros?= Date: Fri, 19 Jun 2026 11:00:20 +0200 Subject: [PATCH 2/2] format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Attila Mészáros --- .../eventing/TriggerReconcilerOnAllEventIT.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/triggerallevent/eventing/TriggerReconcilerOnAllEventIT.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/triggerallevent/eventing/TriggerReconcilerOnAllEventIT.java index e0d25afedf..744f01bbec 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/triggerallevent/eventing/TriggerReconcilerOnAllEventIT.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/triggerallevent/eventing/TriggerReconcilerOnAllEventIT.java @@ -131,7 +131,8 @@ void additionalFinalizer() { extension.create(res); // Wait until the operator has added its own finalizer before deleting. Right after create the - // resource already has exactly [ADDITIONAL_FINALIZER], so without this the assertion below could + // resource already has exactly [ADDITIONAL_FINALIZER], so without this the assertion below + // could // pass prematurely (before the add/mark-for-deletion/remove cycle), snapshotting a stale event // count and making the phase-2 `eventCount + 1` assertion flaky. await()