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
commit ca91375a5cc7325e638833bb076eb97d7254159e Author: Claus Ibsen <[email protected]> AuthorDate: Thu Sep 10 15:21:18 2026 +0200 ci: Fix order-dependent config list assertions in CamelConfigITCase CamelConfigITCase shares a single container across its tests, and the global config file survives the @AfterEach cleanup (which deliberately keeps hidden files). The config is backed by OrderedProperties, so "config list" prints keys in insertion order. testCamelUnsetConfig removes the "runtime" key, so when a later test re-sets all three keys, "runtime" is re-inserted last while "gav" and "directory" keep their existing slots. The hard-coded multi-line assertion then fails for whichever list-asserting test runs second. "config list" makes no ordering guarantee, so assert the presence of each entry instead of a fixed block. Added checkCommandOutputsAll() to JBangTestSupport so this still costs a single command invocation. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../org/apache/camel/dsl/jbang/it/CamelConfigITCase.java | 16 ++++++++-------- .../camel/dsl/jbang/it/support/JBangTestSupport.java | 9 +++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CamelConfigITCase.java b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CamelConfigITCase.java index 0f22f54d8e34..5a5433c2f851 100644 --- a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CamelConfigITCase.java +++ b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CamelConfigITCase.java @@ -36,10 +36,10 @@ public class CamelConfigITCase extends JBangTestSupport { execute("config set gav=com.foo:acme:1.0-SNAPSHOT"); execute("config set runtime=quarkus"); execute("config set directory=" + mountPoint()); - checkCommandOutputs("config list", - "gav = com.foo:acme:1.0-SNAPSHOT\n" + - "runtime = quarkus\n" + - "directory = " + mountPoint()); + checkCommandOutputsAll("config list", + "gav = com.foo:acme:1.0-SNAPSHOT", + "runtime = quarkus", + "directory = " + mountPoint()); } @Test @@ -47,10 +47,10 @@ public class CamelConfigITCase extends JBangTestSupport { execute("config set gav=com.foo:acme:1.0-SNAPSHOT"); execute("config set runtime=quarkus"); execute("config set directory=" + mountPoint()); - checkCommandOutputs("config list", - "gav = com.foo:acme:1.0-SNAPSHOT\n" + - "runtime = quarkus\n" + - "directory = " + mountPoint()); + checkCommandOutputsAll("config list", + "gav = com.foo:acme:1.0-SNAPSHOT", + "runtime = quarkus", + "directory = " + mountPoint()); execute("config unset runtime"); checkCommandDoesNotOutput("config list", "runtime = quarkus"); } diff --git a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java index 7b174e6a335e..66222f550ef2 100644 --- a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java +++ b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java @@ -215,6 +215,15 @@ public abstract class JBangTestSupport { .contains(contains); } + /** + * Asserts that a single invocation of the command outputs all of the given fragments, in any order. + */ + protected void checkCommandOutputsAll(String command, String... contains) { + Assertions.assertThat(execute(command)) + .as("command " + getMainCommand() + " " + command + " should output " + String.join(", ", contains)) + .contains(contains); + } + protected void checkCommandFailsWithError(String command, String error) { Assertions.assertThat(execute(command, true, true)) .as("command " + getMainCommand() + " " + command + " should fail with error " + error)
