This is an automated email from the ASF dual-hosted git repository.
DomGarguilo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 217d09cffe Adding/Updating Wait Blocks in some ITs (#6426)
217d09cffe is described below
commit 217d09cffe7fb225908698a1d72dae64df8204e5
Author: Amanda Villarreal <[email protected]>
AuthorDate: Mon Jun 15 12:08:13 2026 -0500
Adding/Updating Wait Blocks in some ITs (#6426)
* replacing some regular assert statements with Wait.waitFor blocks
* fix one spot where an assert was within a wait block
---------
Co-authored-by: Dom G. <[email protected]>
---
.../org/apache/accumulo/test/ListCompactionsIT.java | 21 ++++++++++++++++-----
.../java/org/apache/accumulo/test/LocatorIT.java | 4 ++--
.../accumulo/test/conf/ResourceGroupConfigIT.java | 8 +++++---
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/test/src/main/java/org/apache/accumulo/test/ListCompactionsIT.java
b/test/src/main/java/org/apache/accumulo/test/ListCompactionsIT.java
index 56dcc135ae..b375aa345f 100644
--- a/test/src/main/java/org/apache/accumulo/test/ListCompactionsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ListCompactionsIT.java
@@ -44,6 +44,7 @@ import org.apache.accumulo.server.util.ListCompactions;
import
org.apache.accumulo.server.util.ListCompactions.RunningCompactionSummary;
import org.apache.accumulo.test.compaction.ExternalCompactionTestUtils;
import org.apache.accumulo.test.functional.SlowIterator;
+import org.apache.accumulo.test.util.Wait;
import org.apache.hadoop.conf.Configuration;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
@@ -105,13 +106,23 @@ public class ListCompactionsIT extends
SharedMiniClusterBase {
ExternalCompactionTestUtils.getRunningCompactions(getCluster().getServerContext());
}
- final List<RunningCompactionSummary> running =
- new
ListCompactionsWrapper().getRunningCompactions(getCluster().getServerContext(),
true);
+ final List<RunningCompactionSummary> running = new ArrayList<>();
final Map<String,RunningCompactionSummary> compactionsByEcid = new
HashMap<>();
- running.forEach(rcs -> compactionsByEcid.put(rcs.getEcid(), rcs));
+ final var expectedCompactions = expected;
- assertEquals(expected.size(), compactionsByEcid.size());
- expected.values().forEach(tec -> {
+ Wait.waitFor(() -> {
+ running.clear();
+ compactionsByEcid.clear();
+
+ running.addAll(new ListCompactionsWrapper()
+ .getRunningCompactions(getCluster().getServerContext(), true));
+ running.forEach(rcs -> compactionsByEcid.put(rcs.getEcid(), rcs));
+
+ return expectedCompactions.size() == compactionsByEcid.size()
+ &&
expectedCompactions.keySet().stream().allMatch(compactionsByEcid::containsKey);
+ }, 10000);
+
+ expectedCompactions.values().forEach(tec -> {
RunningCompactionSummary rcs =
compactionsByEcid.get(tec.job.getExternalCompactionId());
assertNotNull(rcs);
assertEquals(tec.getJob().getExternalCompactionId(), rcs.getEcid());
diff --git a/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
b/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
index 0227c7e4ba..4a5c6835ed 100644
--- a/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
@@ -215,8 +215,8 @@ public class LocatorIT extends AccumuloClusterHarness {
// Accessing table3 in the cache should cause table1 and table4 to
eventually be cleared
// because they no longer exist. This also test that online and
offline tables a properly
// cleared from the cache.
- assertNotNull(ctx.getTabletLocationCache(tableId3));
- return !ctx.isTabletLocationCachePresent(tableId1)
+ var t3 = ctx.getTabletLocationCache(tableId3);
+ return t3 != null && !ctx.isTabletLocationCachePresent(tableId1)
&& !ctx.isTabletLocationCachePresent(tableId4);
});
diff --git
a/test/src/main/java/org/apache/accumulo/test/conf/ResourceGroupConfigIT.java
b/test/src/main/java/org/apache/accumulo/test/conf/ResourceGroupConfigIT.java
index cc418195fe..bd43be7ef1 100644
---
a/test/src/main/java/org/apache/accumulo/test/conf/ResourceGroupConfigIT.java
+++
b/test/src/main/java/org/apache/accumulo/test/conf/ResourceGroupConfigIT.java
@@ -274,9 +274,11 @@ public class ResourceGroupConfigIT extends
SharedMiniClusterBase {
assertEquals(rgid, rgs2.iterator().next());
client.resourceGroupOperations().create(rgid); // creating again
succeeds doing nothing
client.resourceGroupOperations().remove(rgid);
- rgs = client.resourceGroupOperations().list();
- assertEquals(1, rgs.size());
- assertEquals(ResourceGroupId.DEFAULT, rgs.iterator().next());
+
+ Wait.waitFor(() -> {
+ final Set<ResourceGroupId> finalrgs =
client.resourceGroupOperations().list();
+ return finalrgs.size() == 1 &&
finalrgs.contains(ResourceGroupId.DEFAULT);
+ });
assertThrows(ResourceGroupNotFoundException.class,
() -> client.resourceGroupOperations().remove(rgid));
}