[
https://issues.apache.org/jira/browse/CAMEL-27108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18146169#comment-18146169
]
Guillaume Nodet commented on CAMEL-27108:
-----------------------------------------
Investigated the flaky test
ForegroundTimeTaskTest.testRunNoMorePredicateMaxDuration (on behalf of gnodet).
Root cause confirmed by code reading:
- The test uses maxDuration=5s and interval=1s, asserting exactly 5 iterations
(assertEquals(5, taskCount))
- On slow CI, each iteration takes slightly more than 1s (JVM warmup, GC
pauses, etc.), causing the 5s budget to expire before the 5th iteration
completes
- Failure modes observed: expected <5> but was <3> and expected <5> but was <4>
- The IterationTimeBoundedBudget.canContinue() correctly stops early when
elapsed >= maxDuration
Fix: Increase maxDuration to 10s (or use a relaxed assertion) to give the 5
iterations enough room to complete on slow CI. The IterationTimeBoundedBudget
stops at the iteration count anyway if maxIterations is set lower than time
allows.
This is being investigated by a coding agent and a fix PR will be opened.
_Note: This comment was generated by an AI coding agent and requires manual
verification._
> Fix flaky test ForegroundTimeTaskTest
> -------------------------------------
>
> Key: CAMEL-27108
> URL: https://issues.apache.org/jira/browse/CAMEL-27108
> Project: Camel
> Issue Type: Test
> Components: camel-core
> Affects Versions: 4.24.0
> Reporter: Aurélien Pupier
> Assignee: Guillaume Nodet
> Priority: Major
>
> [16 times flaky in last 7 days
> |https://develocity.apache.org/scans/tests?search.startTimeMax=1794956399999&search.startTimeMin=1794265200000&search.timeZoneId=Europe%2FParis&tests.container=org.apache.camel.support.task.task.ForegroundTimeTaskTest&tests.test=testRunNoMorePredicateMaxDuration]
> {noformat}
> org.opentest4j.AssertionFailedError: expected: <5> but was: <3>
> at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:569)
> at
> org.apache.camel.support.task.task.ForegroundTimeTaskTest.testRunNoMorePredicateMaxDuration(ForegroundTimeTaskTest.java:117)
>
> {noformat}
> {noformat}
> org.opentest4j.AssertionFailedError: expected: <5> but was: <4>
> at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:569)
> at
> org.apache.camel.support.task.task.ForegroundTimeTaskTest.testRunNoMorePredicateMaxDuration(ForegroundTimeTaskTest.java:117)
>
> {noformat}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)