maheshrajus commented on code in PR #520:
URL: https://github.com/apache/tez/pull/520#discussion_r3674218346
##########
tez-api/src/test/java/org/apache/tez/client/TestTezClientUtils.java:
##########
@@ -1003,4 +1008,41 @@ public void
testSessionCredentialsMergedBeforeAmConfigCredentials() throws Excep
// session token should be applied while creating ContainerLaunchContext
assertEquals(sessionToken, amLaunchCredentials.getToken(tokenType));
}
+
+ /**
+ * Covers the YARN-808 guard in TezClientUtils#getAMProxy
+ */
+ @Test
+ @Timeout(value = 5000, unit = TimeUnit.MILLISECONDS)
+ public void testGetAMProxyReturnsNullWhenRpcEndpointNotAvailable() throws
Exception {
+ TezConfiguration conf = new TezConfiguration();
+ ApplicationId appId = ApplicationId.newInstance(1L, 1);
+ UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
+
+ // Case 1: rpcPort == -1 (YARN-808 gap — AM container up, RPC not bound)
+ assertNull(TezClientUtils.getAMProxy(
+ newRunningFrameworkClient(appId, "somehost", -1), conf, appId, ugi),
+ "rpcPort == -1 should return null");
+
+ // Case 2: rpcPort == 0 (protobuf wire default)
+ assertNull(TezClientUtils.getAMProxy(
+ newRunningFrameworkClient(appId, "somehost", 0), conf, appId, ugi),
+ "rpcPort == 0 should return null");
+
+ // Case 3: host == "N/A" (RM has not yet received AM registration)
+ assertNull(TezClientUtils.getAMProxy(
+ newRunningFrameworkClient(appId, "N/A", 8080), conf, appId, ugi),
+ "host == N/A should return null");
Review Comment:
Done.
Added the // Case 4: `host == null`
--
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]