DomGarguilo commented on code in PR #3318:
URL: https://github.com/apache/accumulo/pull/3318#discussion_r1175289757
##########
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:
If this test looks okay I might merge it in and create a follow on ticket
for consolidating/reworking the wait/retry functionality
--
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]