From 1ce58ac2ea945baaaeece233f3d3735686a2ecb8 Mon Sep 17 00:00:00 2001 From: Marcus Eriksson Date: Mon, 2 Mar 2020 15:19:31 +0100 Subject: [PATCH] Wait for compactions to finish in PendingAntiCompactionBytemanTest Patch by marcuse; reviewed by David Capwell for CASSANDRA-15552 --- .../cassandra/db/repair/PendingAntiCompactionBytemanTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/unit/org/apache/cassandra/db/repair/PendingAntiCompactionBytemanTest.java b/test/unit/org/apache/cassandra/db/repair/PendingAntiCompactionBytemanTest.java index 9271866e7b..127a0a4c82 100644 --- a/test/unit/org/apache/cassandra/db/repair/PendingAntiCompactionBytemanTest.java +++ b/test/unit/org/apache/cassandra/db/repair/PendingAntiCompactionBytemanTest.java @@ -30,6 +30,7 @@ import com.google.common.collect.Lists; import org.junit.Test; import org.junit.runner.RunWith; import org.apache.cassandra.db.compaction.CompactionInterruptedException; +import org.apache.cassandra.db.compaction.CompactionManager; import org.apache.cassandra.dht.Range; import org.apache.cassandra.dht.Token; import org.apache.cassandra.io.sstable.format.SSTableReader; @@ -75,6 +76,9 @@ public class PendingAntiCompactionBytemanTest extends AbstractPendingAntiCompact { assertTrue(e.getCause() instanceof CompactionInterruptedException); } + // Note that since we fail the PAC immediately when any of the anticompactions fail we need to wait for the other + // AC to finish as well before asserting that we have nothing compacting. + CompactionManager.instance.waitForCessation(Lists.newArrayList(cfs, cfs2), (sstable) -> true); // and make sure nothing is marked compacting assertTrue(cfs.getTracker().getCompacting().isEmpty()); assertTrue(cfs2.getTracker().getCompacting().isEmpty());