Skip to content

Commit

Permalink
Add gRPC client test port as well -- no need to guess the test port, …
Browse files Browse the repository at this point in the history
…if explicity set
  • Loading branch information
alesj committed Sep 19, 2023
1 parent f974941 commit 9ef242c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public class GrpcClientConfiguration {
@ConfigItem(defaultValue = "9000")
public int port;

/**
* The gRPC service test port.
*/
@ConfigItem
public OptionalInt testPort;

/**
* The host name / IP on which the service is exposed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,18 @@ public static Channel createChannel(String name, Set<String> perClientIntercepto
throw new IllegalStateException("gRPC client " + name + " is missing configuration.");
}

if (LaunchMode.current() == LaunchMode.TEST) {
config.port = testPort(configProvider.getServerConfiguration());
}

GrpcBuilderProvider provider = GrpcBuilderProvider.findChannelBuilderProvider(config);

boolean vertxGrpc = config.useQuarkusGrpcClient;

String host = config.host;

// handle client port
int port = config.port;
if (LaunchMode.current() == LaunchMode.TEST) {
port = config.testPort.orElse(testPort(configProvider.getServerConfiguration()));
}

String nameResolver = config.nameResolver;

boolean stork = Stork.STORK.equalsIgnoreCase(nameResolver);
Expand Down

0 comments on commit 9ef242c

Please sign in to comment.