smengcl commented on code in PR #8964:
URL: https://github.com/apache/hadoop/pull/8964#discussion_r4519734968
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/util/TestWebAppUtils.java:
##########
@@ -93,6 +95,17 @@ void TestRMWebAppURLRemoteAndLocal() throws
UnknownHostException {
"ResolvedRMWebAppUrl should resolve to the default RM webapp address");
}
+ @Test
+ void testGetResolvedAddress() throws UnknownHostException {
+ assertEquals("1.2.3.4:8088",
WebAppUtils.getResolvedAddress(literalSocketAddr("1.2.3.4", 8088)));
+ assertEquals("[2001:db8::1]:8088",
WebAppUtils.getResolvedAddress(literalSocketAddr("2001:db8::1", 8088)));
Review Comment:
Wrapped, thanks.
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java:
##########
@@ -149,7 +150,7 @@ private String buildRedirectPath() {
YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS,
YarnConfiguration.DEFAULT_RM_WEBAPP_PORT);
- path = sock.getHostName() + ":" + sock.getPort();
+ path = NetUtils.getHostPortString(sock);
Review Comment:
`buildRedirectPath` only builds the URL after `RMHAUtils.findActiveRMHAId`
finds an active RM over RPC, so a unit test would need a running RM or static
mocking, which this module does not set up. Instead, `RMWebApp` and
`RMWebAppFilter` now share one helper, `RMWebApp.getWebAppURLWithScheme`, which
`TestRMWebApp#testGetWebAppURLWithScheme` covers for IPv4 and IPv6. The standby
redirect and the no active RM retry both use it.
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java:
##########
@@ -433,6 +443,33 @@ public void testCustomWebServiceClass() {
assertFalse(resourceConfig.isRegistered(RMWebServices.class));
}
+ @Test
+ public void testStandbyRefreshUrl() throws Exception {
+
assertThat(standbyRefreshUrl("1.2.3.4:8088")).startsWith("http://1.2.3.4:8088/cluster/apps?");
+
assertThat(standbyRefreshUrl("[2001:db8::1]:8088")).startsWith("http://[2001:db8::1]:8088/cluster/apps?");
Review Comment:
That test was replaced by `testGetWebAppURLWithScheme`, which is within 100
characters.
--
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]