Wait for compactions to finish in PendingAntiCompactionBytemanTest

Patch by marcuse; reviewed by David Capwell for CASSANDRA-15552
This commit is contained in:
Marcus Eriksson 2020-03-02 15:19:31 +01:00
parent 219d209651
commit 1ce58ac2ea
1 changed files with 4 additions and 0 deletions

View File

@ -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());