gnodet-bot commented on code in PR #29928:
URL: https://github.com/apache/camel/pull/29928#discussion_r4573360666
##########
core/camel-core/src/test/java/org/apache/camel/support/RouteWatcherReloadDataDirTest.java:
##########
@@ -119,6 +119,29 @@ public void
testAFilePatternExcludeLeavesOutFilesNotFolders() throws Exception {
assertThat(scanNames()).containsExactly("readme.txt",
"shop.camel.yaml");
}
+ @Test
+ public void testTheFilesARunWritesAreNotWatched() throws Exception {
+ // CAMEL-26930: camel dev > run.log in the project reloaded all the
routes every 2 seconds; the pattern of
+ // camel run --dev with a source directory leaves out logs, the build
output, git and the Camel folders
+
start("*,!test/**,!*.log,!target/**,!.git/**,!.camel/**,!.camel-jbang/**");
+ assertThat(scanNames()).containsExactly("order-0.json",
"order-1.json", "shop.camel.yaml");
+
+ Files.writeString(dir.resolve("run.log"), "a line");
+ Files.createDirectories(dir.resolve("logs"));
+ Files.writeString(dir.resolve("logs/app.log"), "a line");
+ Files.createDirectories(dir.resolve("target/classes"));
+ Files.writeString(dir.resolve("target/classes/Foo.class"), "bytes");
+ Files.createDirectories(dir.resolve(".git"));
+ Files.writeString(dir.resolve(".git/index"), "index");
+ Files.createDirectories(dir.resolve(".camel"));
+ Files.writeString(dir.resolve(".camel/order-1.json"), "{}");
+ assertThat(scanNames()).isEmpty();
+
+ // the route is still watched
+ Files.writeString(dir.resolve("shop.camel.yaml"), "one and two");
Review Comment:
🔍 **Minor nit:** The test covers `*.log`, `target/**`, `.git/**`, and
`.camel/**` but not `.camel-jbang/**`. The pattern string is verified in
`RunTest.sourceDirReloadPatternLeavesTheDataDirsOut`, so coverage is not
missing, but a `Files.writeString(dir.resolve(".camel-jbang/app.lock"),
"lock")` before the `isEmpty()` assertion would make this test exhaustive
against all five new excludes.
```suggestion
Files.writeString(dir.resolve("run.log"), "a line");
Files.createDirectories(dir.resolve("logs"));
Files.writeString(dir.resolve("logs/app.log"), "a line");
Files.createDirectories(dir.resolve("target/classes"));
Files.writeString(dir.resolve("target/classes/Foo.class"), "bytes");
Files.createDirectories(dir.resolve(".git"));
Files.writeString(dir.resolve(".git/index"), "index");
Files.createDirectories(dir.resolve(".camel"));
Files.writeString(dir.resolve(".camel/order-1.json"), "{}");
Files.createDirectories(dir.resolve(".camel-jbang"));
Files.writeString(dir.resolve(".camel-jbang/app.lock"), "lock");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]