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 a8b022b642..3226611ea1 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 @@ -181,19 +181,16 @@ void additionalEventDuringRetryOnDeleteEvent() { extension.create(res); extension.delete(getResource()); - await() - .pollDelay(Duration.ofMillis(30)) - .untilAsserted( - () -> { - assertThat(reconciler.getEventCount()).isGreaterThan(2); - }); - var eventCount = reconciler.getEventCount(); - + // Don't assume a fixed number of reconciliations before the first retry: if the delete event + // arrives before the first reconciliation reads the resource, the finalizer-adding + // reconciliation is skipped. The reconciler increments the counter before it starts waiting, + // and nothing else reconciles while it waits, so the count read after this is stable. await() .untilAsserted( () -> { assertThat(reconciler.isWaiting()).isTrue(); }); + var eventCount = reconciler.getEventCount(); // trigger reconciliation while waiting in reconciler res = getResource();