This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 0c1e85c8631c CAMEL-25860: camel-core - fix flaky 
PollEnrichTimeoutFileBodyTest
0c1e85c8631c is described below

commit 0c1e85c8631c0c0b59e2ead25789a87c4da5bdf5
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Oct 22 16:57:00 2026 +0200

    CAMEL-25860: camel-core - fix flaky PollEnrichTimeoutFileBodyTest
    
    theVariableIsNullWhenNothingWasPolled read the body of the received 
exchange after the mock was satisfied. The body of
    a file consumer message is read from its file on demand, and the consumer 
moves the file to .camel once the route
    completes, so the late read failed with NoSuchFileException when the route 
won the race (seen on CI). The mock now
    checks the body with expectedBodiesReceived, which reads it when the 
message arrives.
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../camel/processor/enricher/PollEnrichTimeoutFileBodyTest.java      | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnrichTimeoutFileBodyTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnrichTimeoutFileBodyTest.java
index a5f5342136ed..1fa36f093052 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnrichTimeoutFileBodyTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnrichTimeoutFileBodyTest.java
@@ -47,15 +47,14 @@ class PollEnrichTimeoutFileBodyTest extends 
ContextTestSupport {
     @Test
     void theVariableIsNullWhenNothingWasPolled() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:variable");
-        mock.expectedMessageCount(1);
+        // the order is kept as the body; the mock reads it on arrival, as the 
file is moved once the route completes
+        mock.expectedBodiesReceived("ORD-1001");
 
         template.sendBodyAndHeader(fileUri("orders-variable"), "ORD-1001", 
Exchange.FILE_NAME, "order-1001.json");
 
         mock.assertIsSatisfied();
         Exchange exchange = mock.getReceivedExchanges().get(0);
         assertNull(exchange.getVariable("customer"), "nothing was polled, so 
no variable");
-        // the order is kept as the body
-        assertEquals("ORD-1001", exchange.getMessage().getBody(String.class));
     }
 
     @Test

Reply via email to