Skip to content

Commit 6ba110a

Browse files
csviriclaude
andauthored
test: fix flaky additionalFinalizer in TriggerReconcilerOnAllEventIT (#3434)
* test: fix flaky additionalFinalizer in TriggerReconcilerOnAllEventIT 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) <noreply@anthropic.com> Signed-off-by: Attila Mészáros <a_meszaros@apple.com> * format Signed-off-by: Attila Mészáros <a_meszaros@apple.com> --------- Signed-off-by: Attila Mészáros <a_meszaros@apple.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 039b02c commit 6ba110a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/triggerallevent/eventing/TriggerReconcilerOnAllEventIT.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,17 @@ void additionalFinalizer() {
130130

131131
extension.create(res);
132132

133+
// Wait until the operator has added its own finalizer before deleting. Right after create the
134+
// resource already has exactly [ADDITIONAL_FINALIZER], so without this the assertion below
135+
// could
136+
// pass prematurely (before the add/mark-for-deletion/remove cycle), snapshotting a stale event
137+
// count and making the phase-2 `eventCount + 1` assertion flaky.
138+
await()
139+
.untilAsserted(
140+
() ->
141+
assertThat(getResource().getMetadata().getFinalizers())
142+
.containsExactlyInAnyOrder(ADDITIONAL_FINALIZER, FINALIZER));
143+
133144
extension.delete(getResource());
134145

135146
await()

0 commit comments

Comments
 (0)