Skip to content

Commit

Permalink
Fix flakiness of testAutoSnapshotTTlOnDropAfterRestart
Browse files Browse the repository at this point in the history
Patch by Paulo Motta; Reviewed by Caleb Rackliffe and Andrés de la Peña for CASSANDRA-17804
  • Loading branch information
pauloricardomg authored and adelapena committed Aug 31, 2022
1 parent cd576a0 commit 1ee5df0
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -121,15 +121,15 @@ public void testAutoSnapshotTTlOnDrop() throws IOException
}

/**
* 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);
Expand All @@ -148,8 +148,8 @@ public void testAutoSnapshotTTlOnDropAfterRestart() throws IOException
// 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));
}
Expand Down

0 comments on commit 1ee5df0

Please sign in to comment.