Russole commented on code in PR #11319:
URL: https://github.com/apache/ozone/pull/11319#discussion_r4114031159
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestContainerStateMachine.java:
##########
@@ -209,13 +214,25 @@ public void testRatisSnapshotRetention() throws Exception
{
key.write(("ratis" + i).getBytes(UTF_8));
}
}
+ waitForSnapshotAfter(storage, lastAppliedIndex);
+
files = parentPath.toFile().listFiles();
assertThat(files).isNotNull();
numSnapshots = files.length;
assertThat(Math.abs(ratisServerConfiguration.getNumSnapshotsRetained() -
numSnapshots))
.isLessThanOrEqualTo(1);
}
+ private static void waitForSnapshotAfter(SimpleStateMachineStorage storage,
+ long index) throws Exception {
+ CheckedSupplier<Boolean, IOException> snapshotAdvanced = () -> {
+ SingleFileSnapshotInfo snapshot =
+ StatemachineImplTestUtil.findLatestSnapshot(storage);
+ return snapshot != null && snapshot.getTermIndex().getIndex() > index;
+ };
+ GenericTestUtils.waitFor(snapshotAdvanced, 100, 30_000);
+ }
Review Comment:
`waitForSnapshotAfter` only waits for one new snapshot, while the following
assertion requires the retained snapshot count to be within range. Could we
include the count check in the polling condition to avoid a timing-dependent
failure?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]