Fix flakiness of testAutoSnapshotTTlOnDropAfterRestart

Patch by Paulo Motta; Reviewed by Caleb Rackliffe and Andrés de la Peña for CASSANDRA-17804
This commit is contained in:
Paulo Motta 2022-08-14 21:00:04 -03:00 committed by Andrés de la Peña
parent cd576a0d14
commit 1ee5df02b1
1 changed files with 5 additions and 5 deletions

View File

@ -121,15 +121,15 @@ public class AutoSnapshotTtlTest extends TestBaseImpl
}
/**
* Check that when auto_snapshot_ttl=5s, snapshots created from TRUNCATE are expired after 10s
* Check that when auto_snapshot_ttl=60s, snapshots created from DROP TABLE are expired after a node restart
*/
@Test
public void testAutoSnapshotTTlOnDropAfterRestart() throws IOException
{
int TWENTY_SECONDS = 20; // longer TTL to allow snapshot to survive node restart
int ONE_MINUTE = 60; // longer TTL to allow snapshot to survive node restart
try (Cluster cluster = init(build().withNodes(1)
.withConfig(c -> c.with(Feature.GOSSIP)
.set("auto_snapshot_ttl", String.format("%ds", TWENTY_SECONDS)))
.set("auto_snapshot_ttl", String.format("%ds", ONE_MINUTE)))
.start()))
{
IInvokableInstance instance = cluster.get(1);
@ -148,8 +148,8 @@ public class AutoSnapshotTtlTest extends TestBaseImpl
// Check snapshot is listed after restart
instance.nodetoolResult("listsnapshots").asserts().success().stdoutContains(SNAPSHOT_DROP_PREFIX);
// Check snapshot is removed after at most 21s
await().timeout(TWENTY_SECONDS + 1, SECONDS)
// Check snapshot is removed after at most auto_snapshot_ttl + 1s
await().timeout(ONE_MINUTE + 1, SECONDS)
.pollInterval(1, SECONDS)
.until(() -> !instance.nodetoolResult("listsnapshots").getStdout().contains(SNAPSHOT_DROP_PREFIX));
}