hdaikoku commented on a change in pull request #2787:
URL: https://github.com/apache/hadoop/pull/2787#discussion_r599170545
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/store/TestStateStoreMembershipState.java
##########
@@ -473,6 +478,53 @@ public void testRegistrationExpiredAndDeletion()
}, 100, 3000);
}
+ @Test
+ public void testNamespaceInfoWithUnavailableNameNodeRegistration() throws
IOException {
+ // Populate the state store with one ACTIVE NameNode entry and one
UNAVAILABLE NameNode entry
+ // 1) ns0:nn0 - ACTIVE
+ // 2) ns0:nn1 - UNAVAILABLE
+ List<MembershipState> registrationList = new ArrayList<>();
+ String router = ROUTERS[0];
+ String ns = NAMESERVICES[0];
+ String rpcAddress = "testrpcaddress";
+ String serviceAddress = "testserviceaddress";
+ String lifelineAddress = "testlifelineaddress";
+ String blockPoolId = "testblockpool";
+ String clusterId = "testcluster";
+ String webScheme = "http";
+ String webAddress = "testwebaddress";
+ boolean safemode = false;
+
+ MembershipState record = MembershipState.newInstance(
+ router, ns, NAMENODES[0], clusterId, blockPoolId,
+ rpcAddress, serviceAddress, lifelineAddress, webScheme,
+ webAddress, FederationNamenodeServiceState.ACTIVE, safemode);
+ registrationList.add(record);
+
+ // Set empty clusterId and blockPoolId for UNAVAILABLE NameNode
+ record = MembershipState.newInstance(
+ router, ns, NAMENODES[1], "", "",
+ rpcAddress, serviceAddress, lifelineAddress, webScheme,
+ webAddress, FederationNamenodeServiceState.UNAVAILABLE, safemode);
+ registrationList.add(record);
+
+ registerAndLoadRegistrations(registrationList);
+
+ GetNamespaceInfoRequest request = GetNamespaceInfoRequest.newInstance();
+ GetNamespaceInfoResponse response =
membershipStore.getNamespaceInfo(request);
+ Set<FederationNamespaceInfo> namespaces = response.getNamespaceInfo();
+
+ // Verify only one namespace is registered
+ assertThat(namespaces).hasSize(1);
Review comment:
Didn't have any particular reason so I switched it to assertEquals:
d07a0b0
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]