Skip to content

Commit

Permalink
Adds argLine to instrument Integration Tests
Browse files Browse the repository at this point in the history
* Fix #7536 by adding the ability to specify an argLine property when running tests.

For Example, in a project I'm building:
```
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${surefire-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <systemPropertyVariables>
                                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                                <maven.home>${maven.home}</maven.home>
                                <quarkus.test.native-image-profile>it</quarkus.test.native-image-profile>
                                <argLine>${argLine}</argLine>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
```
  • Loading branch information
bvarner committed Jun 3, 2021
1 parent 0641dc7 commit 6d121e4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class JarLauncher implements ArtifactLauncher {

private final Path jarPath;
private final String profile;
private final String argLine;
private Process quarkusProcess;
private final int httpPort;
private final int httpsPort;
Expand All @@ -39,6 +40,7 @@ private JarLauncher(Path jarPath, Config config) {
config.getValue("quarkus.http.test-port", OptionalInt.class).orElse(DEFAULT_PORT),
config.getValue("quarkus.http.test-ssl-port", OptionalInt.class).orElse(DEFAULT_HTTPS_PORT),
config.getValue("quarkus.test.jar-wait-time", OptionalLong.class).orElse(DEFAULT_JAR_WAIT_TIME),
config.getOptionalValue("quarkus.test.argLine", String.class).orElse(null),
config.getOptionalValue("quarkus.test.native-image-profile", String.class)
.orElse(null));
}
Expand All @@ -47,11 +49,12 @@ public JarLauncher(Path jarPath) {
this(jarPath, installAndGetSomeConfig());
}

public JarLauncher(Path jarPath, int httpPort, int httpsPort, long jarWaitTime, String profile) {
public JarLauncher(Path jarPath, int httpPort, int httpsPort, long jarWaitTime, String argLine, String profile) {
this.jarPath = jarPath;
this.httpPort = httpPort;
this.httpsPort = httpsPort;
this.jarWaitTime = jarWaitTime;
this.argLine = argLine;
this.profile = profile;
}

Expand All @@ -61,6 +64,9 @@ public void start() throws IOException {

List<String> args = new ArrayList<>();
args.add("java");
if (argLine != null) {
args.add(argLine);
}
args.add("-Dquarkus.http.port=" + httpPort);
args.add("-Dquarkus.http.ssl-port=" + httpsPort);
// this won't be correct when using the random port but it's really only used by us for the rest client tests
Expand Down

0 comments on commit 6d121e4

Please sign in to comment.