Github user GJL commented on a diff in the pull request:
https://github.com/apache/flink/pull/5838#discussion_r181140084
--- Diff:
flink-clients/src/test/java/org/apache/flink/client/program/rest/RestClusterClientTest.java
---
@@ -677,6 +682,37 @@ public void testGetAccumulators() throws Exception {
}
}
+ /**
+ * Tests that command line options override the configuration settings.
+ */
+ @Test
+ public void testRESTManualConfigurationOverride() throws Exception {
+ final String localhost = "localhost";
+ final int port = 1234;
+ final Configuration configuration = new Configuration();
+
+ configuration.setString(JobManagerOptions.ADDRESS, localhost);
+ configuration.setInteger(JobManagerOptions.PORT, port);
+ configuration.setString(RestOptions.REST_ADDRESS, localhost);
+ configuration.setInteger(RestOptions.REST_PORT, port);
+
+ final DefaultCLI defaultCLI = new DefaultCLI(configuration);
+
+ final String manualHostname = "123.123.123.123";
+ final int manualPort = 4321;
+ final String[] args = {"-m", manualHostname + ':' + manualPort};
+
+ CommandLine commandLine =
defaultCLI.parseCommandLineOptions(args, false);
+
+ final StandaloneClusterDescriptor clusterDescriptor =
defaultCLI.createClusterDescriptor(commandLine);
+
+ final RestClusterClient<?> clusterClient =
clusterDescriptor.retrieve(defaultCLI.getClusterId(commandLine));
+
+ URL webMonitorBaseUrl =
clusterClient.getWebMonitorBaseUrl().get();
+ assertThat(webMonitorBaseUrl.getHost(),
Matchers.equalTo(manualHostname));
+ assertThat(webMonitorBaseUrl.getPort(),
Matchers.equalTo(manualPort));
--- End diff --
There is already a static import for `equalTo` in this file. I think it
should be used, i.e.,
```
assertThat(webMonitorBaseUrl.getHost(), equalTo(manualHostname));
assertThat(webMonitorBaseUrl.getPort(), equalTo(manualPort));
```
---