Skip to content

Commit

Permalink
Support QUARKUS_TEST_PROFILE environment variable
Browse files Browse the repository at this point in the history
The config [entry](https://quarkus.io/guides/continuous-testing#quarkus-test-dev-testing-test-config_quarkus.test.profile) mentions the environment variable, so let's support it

Fixes: #29944
  • Loading branch information
geoand committed Dec 19, 2022
1 parent 4f42868 commit 2f24c69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ProfileManager {
public static final String QUARKUS_PROFILE_ENV = "QUARKUS_PROFILE";
public static final String QUARKUS_PROFILE_PROP = "quarkus.profile";
public static final String QUARKUS_TEST_PROFILE_PROP = "quarkus.test.profile";
public static final String QUARKUS_TEST_PROFILE_ENV = "QUARKUS_TEST_PROFILE";
private static final String BACKWARD_COMPATIBLE_QUARKUS_PROFILE_PROP = "quarkus-profile";

private static volatile LaunchMode launchMode = LaunchMode.NORMAL;
Expand Down Expand Up @@ -52,6 +53,10 @@ public static String getActiveProfile() {
if (profile != null) {
return profile;
}
profile = System.getenv(QUARKUS_TEST_PROFILE_ENV);
if (profile != null) {
return profile;
}
return launchMode.getDefaultProfile();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class BootstrapProfile {
public static final String QUARKUS_PROFILE_ENV = "QUARKUS_PROFILE";
public static final String QUARKUS_PROFILE_PROP = "quarkus.profile";
public static final String QUARKUS_TEST_PROFILE_PROP = "quarkus.test.profile";
public static final String QUARKUS_TEST_PROFILE_ENV = "QUARKUS_TEST_PROFILE";
private static final String BACKWARD_COMPATIBLE_QUARKUS_PROFILE_PROP = "quarkus-profile";
public static final String DEV = "dev";
public static final String PROD = "prod";
Expand All @@ -27,6 +28,10 @@ public static String getActiveProfile(QuarkusBootstrap.Mode mode) {
if (profile != null) {
return profile;
}
profile = System.getenv(QUARKUS_TEST_PROFILE_ENV);
if (profile != null) {
return profile;
}
return "test";
}

Expand Down

0 comments on commit 2f24c69

Please sign in to comment.