Copilot commented on code in PR #8964:
URL: https://github.com/apache/hadoop/pull/8964#discussion_r4519504675
##########
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:
These assertions exceed Hadoop's configured 100-character Checkstyle limit
(`hadoop-build-tools/src/main/resources/checkstyle/checkstyle.xml:72`). Please
wrap the calls so the new test does not fail the style check.
This issue also appears on line 105 of the same file.
##########
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:
The added `testStandbyRefreshUrl` stubs `rmWebApp.getRedirectPath()` to an
empty string, so it only exercises the filter's retry URL and never reaches
`RMWebApp.buildRedirectPath()` (the changed line). Please add an
active-RM/standby test that drives the non-empty redirect branch with an IPv6
web address and asserts the resulting `Location` URL, so this separate code
path is covered.
##########
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:
This IPv6 assertion is 110 characters long and violates the repository's
100-character Checkstyle limit
(`hadoop-build-tools/src/main/resources/checkstyle/checkstyle.xml:72`). Please
wrap the AssertJ chain.
--
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]