This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch elasticity
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/elasticity by this push:
     new ee04ad3aa5 Fixed check in TabletResourceGroupBalanceIT to use 
Wait.waitFor (#4479)
ee04ad3aa5 is described below

commit ee04ad3aa522404cb37a1eceefd2bec34b2d00e7
Author: Dave Marion <dlmar...@apache.org>
AuthorDate: Tue Apr 23 07:28:56 2024 -0400

    Fixed check in TabletResourceGroupBalanceIT to use Wait.waitFor (#4479)
    
    The assertion in testResourceGroupBalanceWithNoTServers started returning
    zero for the number of hosted tablets after the `waitForBalance`. Not sure
    which modification caused this to change behavior, but this fix is likely
    the correct one regardless.
---
 .../functional/TabletResourceGroupBalanceIT.java   | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git 
a/test/src/main/java/org/apache/accumulo/test/functional/TabletResourceGroupBalanceIT.java
 
b/test/src/main/java/org/apache/accumulo/test/functional/TabletResourceGroupBalanceIT.java
index 6b289a72b4..0605a69c2a 100644
--- 
a/test/src/main/java/org/apache/accumulo/test/functional/TabletResourceGroupBalanceIT.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/functional/TabletResourceGroupBalanceIT.java
@@ -225,20 +225,22 @@ public class TabletResourceGroupBalanceIT extends 
SharedMiniClusterBase {
           .addTabletServerResourceGroup("GROUP2", 1);
       getCluster().getClusterControl().start(ServerType.TABLET_SERVER);
 
-      client.instanceOperations().waitForBalance();
-      assertEquals(26, getCountOfHostedTablets(client, tableName));
-      ingest.join();
-      assertNull(error.get());
-
-      client.tableOperations().delete(tableName);
-      // Stop all tablet servers because there is no way to just stop
-      // the GROUP2 server yet.
-      
getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
-      
getCluster().getConfig().getClusterServerConfiguration().clearTServerResourceGroups();
-      getCluster().getConfig().getClusterServerConfiguration()
-          .addTabletServerResourceGroup("GROUP1", 1);
-      getCluster().getClusterControl().start(ServerType.TABLET_SERVER);
+      try {
+        client.instanceOperations().waitForBalance();
+        Wait.waitFor(() -> getCountOfHostedTablets(client, tableName) == 26);
+        ingest.join();
+        assertNull(error.get());
 
+      } finally {
+        client.tableOperations().delete(tableName);
+        // Stop all tablet servers because there is no way to just stop
+        // the GROUP2 server yet.
+        
getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
+        
getCluster().getConfig().getClusterServerConfiguration().clearTServerResourceGroups();
+        getCluster().getConfig().getClusterServerConfiguration()
+            .addTabletServerResourceGroup("GROUP1", 1);
+        getCluster().getClusterControl().start(ServerType.TABLET_SERVER);
+      }
     }
   }
 
@@ -258,7 +260,7 @@ public class TabletResourceGroupBalanceIT extends 
SharedMiniClusterBase {
       client.tableOperations().create(tableName, ntc1);
 
       // wait for all tablets to be hosted
-      Wait.waitFor(() -> 26 != getCountOfHostedTablets(client, tableName));
+      Wait.waitFor(() -> 26 == getCountOfHostedTablets(client, tableName));
 
       client.instanceOperations().waitForBalance();
 

Reply via email to