yandrey321 commented on code in PR #10300:
URL: https://github.com/apache/ozone/pull/10300#discussion_r3258368104
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMClientProtocolServer.java:
##########
@@ -155,12 +159,49 @@ public void testScmGetContainerCount() throws IOException
{
scmServer.stop();
}
}
+
+ @Test
+ public void testListContainerPaginationHasNoDuplicates() throws Exception {
+ Instant base = Instant.parse("2026-01-01T00:00:00Z");
+ List<ContainerInfo> infos = new ArrayList<>();
+ infos.add(newContainerWithLastUsedTime(100, base));
+ infos.add(newContainerWithLastUsedTime(5, base.plusMillis(1)));
+ infos.add(newContainerWithLastUsedTime(10, base.plusMillis(2)));
+
+ SCMClientProtocolServer scmServer =
+ new SCMClientProtocolServer(new OzoneConfiguration(),
+ mockStorageContainerManager(infos),
+ mock(ReconfigurationHandler.class));
+ try {
+ List<Long> ids = new ArrayList<>();
+ long start = 0;
+ int batchSize = 2;
+ while (true) {
+ List<ContainerInfo> page =
+ scmServer.listContainer(start, batchSize, null, null,
null).getContainerInfoList();
+ if (page.isEmpty()) {
+ break;
+ }
+ for (ContainerInfo c : page) {
+ ids.add(c.getContainerID());
+ }
+ start = page.get(page.size() - 1).getContainerID() + 1;
+ }
+ assertEquals(ids.size(), new HashSet<>(ids).size());
Review Comment:
should also assert the sort order and expected ids
--
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]