Skip to content

Commit

Permalink
Ensure that %test.quarkus.http.test-port works properly
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Jul 6, 2020
1 parent 8f46dec commit 540f4a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -865,10 +865,15 @@ private void setupTcpHttpServer(HttpServer httpServer, HttpServerOptions options
clearHttpProperty = true;
schema = "http";
}
System.setProperty(
launchMode == LaunchMode.TEST ? "quarkus." + schema + ".test-port"
: "quarkus." + schema + ".port",
String.valueOf(actualPort));
String portPropertyValue = String.valueOf(actualPort);
String portPropertyName = (launchMode == LaunchMode.TEST ? "quarkus." + schema + ".test-port"
: "quarkus." + schema + ".port");
System.setProperty(portPropertyName, portPropertyValue);
if (launchMode.isDevOrTest()) {
// set the profile property as well to make sure we don't have any inconsistencies
System.setProperty("%" + launchMode.getDefaultProfile() + "." + portPropertyName,
portPropertyValue);
}
// Set in HttpOptions to output the port in the Timing class
options.setPort(actualPort);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ quarkus.security.users.file.enabled=true
quarkus.security.users.file.users=test-users.properties
quarkus.security.users.file.roles=test-roles.properties
quarkus.security.users.file.plain-text=true
%test.quarkus.http.test-port=0

0 comments on commit 540f4a1

Please sign in to comment.