Skip to content

Commit 555f72c

Browse files
committed
Update profile configuration for integration tests
All integration test launchers now first consult `quarkus.test.integration-test-profile` and use `quarkus.profile` as the fallback when determining which profile the application should be run with. We also make sure that the application is not launched with multiple options specifying what profile should be used. Fixes: quarkusio#47400
1 parent e4e13fc commit 555f72c

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConfig.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,10 @@ public interface TestConfig {
157157
@WithDefault("false")
158158
boolean flatClassPath();
159159

160-
/**
161-
* The profile to use when testing the native image
162-
*/
163-
@WithDefault("prod")
164-
String nativeImageProfile();
165-
166160
/**
167161
* The profile to use when testing using {@code @QuarkusIntegrationTest}
168162
*/
169-
@WithDefault("prod")
163+
@WithDefault("${quarkus.profile:prod}")
170164
String integrationTestProfile();
171165

172166
/**

test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusIntegrationTestExtension.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ private QuarkusTestExtensionState doProcessStart(Properties quarkusArtifactPrope
232232
// propagate Quarkus properties set from the build tool
233233
Properties existingSysProps = System.getProperties();
234234
for (String name : existingSysProps.stringPropertyNames()) {
235-
if (name.startsWith("quarkus.")) {
235+
if (name.startsWith("quarkus.")
236+
// don't include 'quarkus.profile' as that has already been taken into account when determining the launch profile
237+
// so we don't want this to end up in multiple launch arguments
238+
&& !name.equals("quarkus.profile")) {
236239
additionalProperties.put(name, existingSysProps.getProperty(name));
237240
}
238241
}

test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusMainIntegrationTestExtension.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ private ArtifactLauncher.LaunchResult doProcessStart(ExtensionContext context, S
144144
// propagate Quarkus properties set from the build tool
145145
Properties existingSysProps = System.getProperties();
146146
for (String name : existingSysProps.stringPropertyNames()) {
147-
if (name.startsWith("quarkus.")) {
147+
if (name.startsWith("quarkus.")
148+
// don't include 'quarkus.profile' as that has already been taken into account when determining the launch profile
149+
// so we don't want this to end up in multiple launch arguments
150+
&& !name.equals("quarkus.profile")) {
148151
additionalProperties.put(name, existingSysProps.getProperty(name));
149152
}
150153
}

test-framework/junit5/src/main/java/io/quarkus/test/junit/launcher/NativeImageLauncherProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public NativeImageLauncher create(CreateContext context) {
4545
config.getValue("quarkus.http.test-port", OptionalInt.class).orElse(DEFAULT_PORT),
4646
config.getValue("quarkus.http.test-ssl-port", OptionalInt.class).orElse(DEFAULT_HTTPS_PORT),
4747
testConfig.waitTime(),
48-
testConfig.nativeImageProfile(),
48+
testConfig.integrationTestProfile(),
4949
TestConfigUtil.argLineValues(testConfig.argLine().orElse("")),
5050
testConfig.env(),
5151
context.devServicesLaunchResult(),

0 commit comments

Comments
 (0)