test: wait for lagging record list in testPaging (#2)

A new client (connection) may see a lagging state of the record list
for a short time, so the small page size check waits until all records
are listed.

refs #2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
thischwaandClaude Opus 5.5 committed 2026-11-04 17:27:10 +01:00
1 parent 4603753e7a
commit a6befc1cf3
1 file changed
+8 -3
@@ -534,9 +534,14 @@ public class CfClientTest {
// Without PagingRequest all pages must be fetched, also if the page size is small
try (CfDnsClient smallPageClient = new CfDnsClient(true, CfDnsClientBuilder.DEFAULT_BASEURL,
new CfDnsClientBuilder.ApiTokenAuth(API_TOKEN), 5)) {
assertEquals(allRecordIds, smallPageClient.recordList(zone).stream()
.map(RecordEntity::getId).collect(Collectors.toSet()));
assertEquals(createdRecords.size(), smallPageClient.recordListByType(zone, RecordType.A).size());
// a new client (connection) may see a lagging state of the record list for a short time
Set<String> smallPageIds = awaitRecords(() -> smallPageClient.recordList(zone),
recs -> recs.size() >= allRecordIds.size()).stream()
.map(RecordEntity::getId).collect(Collectors.toSet());
assertEquals(allRecordIds, smallPageIds);
assertEquals(createdRecords.size(), awaitRecords(
() -> smallPageClient.recordListByType(zone, RecordType.A),
recs -> recs.size() >= createdRecords.size()).size());
assertEquals(1, smallPageClient.recordListBySubdomain(zone, pagingSld + "-01").size());
}
} finally {