virajjasani commented on a change in pull request #1523: HBASE-24195 :
Admin.getRegionServers() should return live servers exc…
URL: https://github.com/apache/hbase/pull/1523#discussion_r409589117
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
##########
@@ -864,4 +865,44 @@ public void testSlowLogResponses() throws Exception {
Assert.assertEquals(onlineLogRecords.size(), 0);
}
+ @Test
+ public void testGetRegionServers() throws Exception {
+ // get all live server names
+ List<ServerName> serverNames = new
ArrayList<>(ADMIN.getRegionServers(true));
+ Assert.assertEquals(3, serverNames.size());
+
+ List<ServerName> serversToDecom = new ArrayList<>();
+ ServerName serverToDecommission = serverNames.get(0);
+
+ serversToDecom.add(serverToDecommission);
+ ADMIN.decommissionRegionServers(serversToDecom, false);
+ waitForServerCommissioned(serverToDecommission, true);
+
+ Assert.assertEquals(2, ADMIN.getRegionServers(true).size());
+ Assert.assertEquals(3, ADMIN.getRegionServers(false).size());
+
+ ADMIN.recommissionRegionServer(serverToDecommission,
Collections.emptyList());
+ waitForServerCommissioned(null, false);
+
+ Assert.assertEquals(3, ADMIN.getRegionServers(true).size());
+ Assert.assertEquals(3, ADMIN.getRegionServers(false).size());
+ }
+
+ private static void waitForServerCommissioned(ServerName excludeServer,
+ boolean anyServerDecommissioned) {
+ TEST_UTIL.waitFor(3000, () -> {
Review comment:
I have used the same before also for decommission test.
----------------------------------------------------------------
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]
With regards,
Apache Git Services