You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "dlmarion (via GitHub)" <gi...@apache.org> on 2023/04/19 20:07:07 UTC

[GitHub] [accumulo] dlmarion commented on a diff in pull request #3318: Improvements to ManagerAssignmentIT

dlmarion commented on code in PR #3318:
URL: https://github.com/apache/accumulo/pull/3318#discussion_r1171802638


##########
test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java:
##########
@@ -146,36 +148,39 @@ public void test() throws Exception {
 
       // set the hosting goal to always
       c.tableOperations().setTabletHostingGoal(tableName, new Range(), TabletHostingGoal.ALWAYS);
-      TabletLocationState always;
-      do {
-        UtilWaitThread.sleep(250);
-        always = getTabletLocationState(c, tableId);
-      } while (always.goal != TabletHostingGoal.ALWAYS && always.current == null);
 
+      Predicate<TabletLocationState> alwaysHostedOrCurrentNotNull =
+          t -> (t.goal == TabletHostingGoal.ALWAYS) || (t.current != null);
+
+      assertTrue(Wait.waitFor(
+          () -> alwaysHostedOrCurrentNotNull.test(getTabletLocationState(c, tableId)), 60000, 250));
+
+      final TabletLocationState always = getTabletLocationState(c, tableId);
+      assertTrue(alwaysHostedOrCurrentNotNull.test(always));
       assertNull(always.future);
       assertEquals(flushed.getCurrentServer(), always.getLastServer());
       assertEquals(TabletHostingGoal.ALWAYS, always.goal);
 
       // set the hosting goal to never
       c.tableOperations().setTabletHostingGoal(tableName, new Range(), TabletHostingGoal.NEVER);
-      TabletLocationState never;
-      do {
-        UtilWaitThread.sleep(250);
-        never = getTabletLocationState(c, tableId);
-      } while (never.goal != TabletHostingGoal.NEVER && never.current != null);
+      Predicate<TabletLocationState> neverHostedOrCurrentNull =
+          t -> (t.goal == TabletHostingGoal.NEVER) || (t.current == null);
+      assertTrue(Wait.waitFor(

Review Comment:
   See [comment](https://github.com/apache/accumulo/pull/3292#discussion_r1171795774). I think there is some consolidation that could occur here.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org