gnodet-bot commented on code in PR #29910:
URL: https://github.com/apache/camel/pull/29910#discussion_r4572832333
##########
dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/RunTest.java:
##########
@@ -266,6 +267,50 @@ void theOptionsOfARunWithMavenAreInTheRequest() {
assertThat(request.dev).isTrue();
}
+ @Test
+ void theBackgroundAndDebugPropertiesStartAnotherJvm() {
+ Run command = new Run(new CamelJBangMain());
+ CommandLineTestHelper.parse(command, "route.yaml");
+ command.spawned = false;
+
+ command.applyProfileProperties(command.toRunRequest(null),
backgroundAndDebugProperties());
+
+ assertThat(command.background).isTrue();
+ assertThat(command.backgroundWait).isEqualTo(5000);
+ assertThat(command.jvmDebugPort).isEqualTo(4004);
+ }
+
+ @Test
+ void aJvmThatARunStartedDoesNotStartAnotherFromTheProperties() {
+ // the JVM in the background reads the same application.properties:
before, it went to the background
+ // again, and its own child too, without end (CAMEL-26930)
+ Run command = new Run(new CamelJBangMain());
+ CommandLineTestHelper.parse(command, "route.yaml");
+ command.spawned = true;
+
+ command.applyProfileProperties(command.toRunRequest(null),
backgroundAndDebugProperties());
+
+ assertThat(command.background).isFalse();
+ assertThat(command.jvmDebugPort).isZero();
Review Comment:
The spawned-JVM test asserts that `background` and `jvmDebugPort` are
unaffected but omits `backgroundWait` — which is also inside the `if
(!spawned)` guard. Adding it closes the symmetry with
`theBackgroundAndDebugPropertiesStartAnotherJvm`, which does assert all three.
```suggestion
assertThat(command.background).isFalse();
assertThat(command.backgroundWait).isEqualTo(BackgroundWait.DEFAULT);
assertThat(command.jvmDebugPort).isZero();
```
--
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]