From a6befc1cf3101e648a4ee256b4f107829f40a699 Mon Sep 17 00:00:00 2001 From: Thilo Schwarz Date: Wed, 4 Nov 2026 17:27:10 +0100 Subject: [PATCH] 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 --- src/test/java/codes/thischwa/cf/CfClientTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/test/java/codes/thischwa/cf/CfClientTest.java b/src/test/java/codes/thischwa/cf/CfClientTest.java index f09bc6c..8712b50 100644 --- a/src/test/java/codes/thischwa/cf/CfClientTest.java +++ b/src/test/java/codes/thischwa/cf/CfClientTest.java @@ -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 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 {