Skip to content

Commit

Permalink
Flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Jan 13, 2025
1 parent 0df4423 commit 207df4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,13 @@ public class DurationRoutePolicyFactoryTest extends ContextTestSupport {

@Test
public void testDurationRoutePolicyFactory() throws Exception {
assertTrue(context.getRouteController().getRouteStatus("foo").isStarted());
assertFalse(context.getRouteController().getRouteStatus("foo").isStopped());

// the policy should stop the route after 2 seconds which is approx
// 20-30 messages
getMockEndpoint("mock:foo").expectedMinimumMessageCount(10);
assertMockEndpointsSatisfied();

// need a little time to stop async
await().atMost(5, TimeUnit.SECONDS).untilAsserted(() -> {
// need some time to stop async
await().atMost(10, TimeUnit.SECONDS).untilAsserted(() -> {
assertFalse(context.getRouteController().getRouteStatus("foo").isStarted());
assertTrue(context.getRouteController().getRouteStatus("foo").isStopped());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
package org.apache.camel.issues;

import java.util.concurrent.TimeUnit;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
Expand All @@ -44,7 +42,7 @@ public void testRecipientListUseOriginalMessageIssue() throws Exception {
template.sendBodyAndHeader(fileUri("inbox"), "A",
Exchange.FILE_NAME, "hello.txt");

assertMockEndpointsSatisfied(100, TimeUnit.MILLISECONDS);
assertMockEndpointsSatisfied();
}

@Override
Expand All @@ -55,7 +53,7 @@ public void configure() {
onException(Exception.class).handled(true).useOriginalMessage().to(fileUri("outbox"))
.to("mock:error");

from(fileUri("inbox?initialDelay=0&delay=10"))
from(fileUri("inbox?initialDelay=100&delay=10"))
.transform(constant("B"))
.setHeader("path", constant("mock:throwException"))
// must enable share uow to let the onException use
Expand Down

0 comments on commit 207df4e

Please sign in to comment.