Skip to content

Commit

Permalink
Consider quarkus.test.arg-line as a string
Browse files Browse the repository at this point in the history
We don't want to split it on commas but spaces so here is a quick fix
for it.
We could write a specific converter but I'm not really sure it's worth
it.

Fixes #45878

(cherry picked from commit 7be5a75)
  • Loading branch information
gsmet committed Jan 28, 2025
1 parent a57952a commit c1d35cc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public interface TestConfig {
* When the artifact is a {@code container}, this string is passed right after the {@code docker run} command.
* When the artifact is a {@code native binary}, this string is passed right after the native binary name.
*/
Optional<@WithConverter(TrimmedStringConverter.class) List<String>> argLine();
Optional<@WithConverter(TrimmedStringConverter.class) String> argLine();

/**
* Additional environment variables to be set in the process that {@code @QuarkusIntegrationTest} launches.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ public final class TestConfigUtil {
private TestConfigUtil() {
}

public static List<String> argLineValues(String argLine) {
if (argLine == null || argLine.isBlank()) {
return List.of();
}
String[] parts = argLine.split("\\s+");
List<String> result = new ArrayList<>(parts.length);
for (String s : parts) {
String trimmed = s.trim();
if (trimmed.isEmpty()) {
continue;
}
result.add(trimmed);
}
return result;
}

@Deprecated(forRemoval = true, since = "3.17")
public static List<String> argLineValue(Config config) {
String strValue = config.getOptionalValue("quarkus.test.arg-line", String.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.quarkus.test.common.ArtifactLauncher;
import io.quarkus.test.common.DefaultDockerContainerLauncher;
import io.quarkus.test.common.DockerContainerArtifactLauncher;
import io.quarkus.test.common.TestConfigUtil;
import io.smallrye.config.SmallRyeConfig;

public class DockerContainerLauncherProvider implements ArtifactLauncherProvider {
Expand Down Expand Up @@ -88,7 +89,7 @@ private void launcherInit(CreateContext context, DockerContainerArtifactLauncher
config.getValue("quarkus.http.test-ssl-port", OptionalInt.class).orElse(DEFAULT_HTTPS_PORT),
testConfig.waitTime(),
testConfig.integrationTestProfile(),
testConfig.argLine().orElse(List.of()),
TestConfigUtil.argLineValues(testConfig.argLine().orElse("")),
testConfig.env(),
context.devServicesLaunchResult(),
containerImage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.quarkus.test.common.ArtifactLauncher;
import io.quarkus.test.common.DefaultJarLauncher;
import io.quarkus.test.common.JarArtifactLauncher;
import io.quarkus.test.common.TestConfigUtil;
import io.smallrye.config.SmallRyeConfig;

public class JarLauncherProvider implements ArtifactLauncherProvider {
Expand Down Expand Up @@ -47,7 +48,7 @@ public JarArtifactLauncher create(CreateContext context) {
config.getValue("quarkus.http.test-ssl-port", OptionalInt.class).orElse(DEFAULT_HTTPS_PORT),
testConfig.waitTime(),
testConfig.integrationTestProfile(),
testConfig.argLine().orElse(List.of()),
TestConfigUtil.argLineValues(testConfig.argLine().orElse("")),
testConfig.env(),
context.devServicesLaunchResult(),
context.buildOutputDirectory().resolve(pathStr)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import io.quarkus.test.common.ArtifactLauncher;
import io.quarkus.test.common.DefaultNativeImageLauncher;
import io.quarkus.test.common.NativeImageLauncher;
import io.quarkus.test.common.TestConfigUtil;
import io.smallrye.config.SmallRyeConfig;

public class NativeImageLauncherProvider implements ArtifactLauncherProvider {
Expand Down Expand Up @@ -45,7 +46,7 @@ public NativeImageLauncher create(CreateContext context) {
config.getValue("quarkus.http.test-ssl-port", OptionalInt.class).orElse(DEFAULT_HTTPS_PORT),
testConfig.waitTime(),
testConfig.nativeImageProfile(),
testConfig.argLine().orElse(List.of()),
TestConfigUtil.argLineValues(testConfig.argLine().orElse("")),
testConfig.env(),
context.devServicesLaunchResult(),
System.getProperty("native.image.path"),
Expand Down

0 comments on commit c1d35cc

Please sign in to comment.