nastra commented on code in PR #6895:
URL: https://github.com/apache/iceberg/pull/6895#discussion_r1114240697
##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -150,7 +154,8 @@ public <T extends RESTResponse> T execute(
servletContext.setVirtualHosts(null);
servletContext.setGzipHandler(new GzipHandler());
- this.httpServer = new Server(8181);
+ initializePort();
+ this.httpServer = new Server(port);
Review Comment:
Jetty already provides functionality to bind to a random port by setting
`this.httpServer = new Server(0);`.
And then we can call `localPort()` in those 2 methods that require the port.
The content of the method should be:
```
private int localPort() {
assertThat(httpServer.isRunning()).isTrue();
return ((ServerConnector) httpServer.getConnectors()[0]).getLocalPort();
}
```
Therefore we don't need to introduce a `port` variable and also we don't
need to find a random port ourselves
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]