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 6392ce54180b CAMEL-25955: watchesFile ignores JVM options with
wildcards to fix flaky test (#28304)
6392ce54180b is described below
commit 6392ce54180b7f7daa6bf11821fff814c4ad0bbd
Author: Aurélien Pupier <[email protected]>
AuthorDate: Fri Oct 23 11:15:09 2026 +0200
CAMEL-25955: watchesFile ignores JVM options with wildcards to fix flaky
test (#28304)
IntegrationLauncher.watchesFile checked a.contains("*") against every
argument on the process command line. When a test selects
ProcessHandle.current().pid() (the Maven Surefire JVM), that process
has options such as -Dtest=* or classpath entries containing *, so the
method incorrectly returned true, treating the test JVM as an
integration that watches every file.
This caused writeFile to wait 8 s for a reload that never comes, then
return reload.status=unknown instead of taking the "not watched by"
fast path, failing assertNull(written.get("reload")) in
AuthoringToolsTest.aWriteOfATemplateTheIntegrationDoesNotWatchIsAnsweredAtOnce.
Fix: exclude arguments that start with "-" from the wildcard check.
A camel run file-glob (*.yaml, *, routes/*) never starts with "-";
JVM options and Maven properties always do. The existing unit test
List.of("run", "*", "--dev") still returns true because "*" does not
start with "-".
Co-authored-by: IBM Bob 2.2.1 <[email protected]>
Signed-off-by: Aurélien Pupier <[email protected]>
---
.../camel/dsl/jbang/core/commands/ai/IntegrationLauncher.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/IntegrationLauncher.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/IntegrationLauncher.java
index f38868a9e16f..49972c634899 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/IntegrationLauncher.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/IntegrationLauncher.java
@@ -473,9 +473,10 @@ public final class IntegrationLauncher {
return true;
}
String name = Path.of(file).getFileName().toString();
- // the file itself on the command line (a Groovy route), or a wildcard
that camel run expands
- return args.stream().anyMatch(a -> a.contains("*") || a.equals(name)
|| a.endsWith("/" + name)
- || a.endsWith(":" + name));
+ // the file itself on the command line (a Groovy route), or a wildcard
that camel run expands;
+ // options (starting with -) are excluded: a JVM option such as
-Dtest=* is not a file glob
+ return args.stream().anyMatch(a -> (!a.startsWith("-") &&
a.contains("*")) || a.equals(name)
+ || a.endsWith("/" + name) || a.endsWith(":" + name));
}
/**