Skip to content

Commit 40456ae

Browse files
committed
test(user_ldap): speed up AbstractMappingTestCase chunking test
The testGetListOfIdsByDn test mapped a DN every 20 entries across 66k entries, producing 3332 DB inserts just to exercise query chunking. Only 14 mapped entries are needed to exceed the 65535-value Postgres IN limit and trigger chunking — so map every 5000th entry instead (14 inserts). Also clarify the comment: it describes why the list exceeds Postgres's 65535-value IN limit, not a per-iteration invariant. Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Anna Larch <anna@nextcloud.com>
1 parent c8b29c9 commit 40456ae

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

apps/user_ldap/tests/Mapping/AbstractMappingTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,16 @@ public function testGetListOfIdsByDn(): void {
284284

285285
$listOfDNs = [];
286286
for ($i = 0; $i < 66640; $i++) {
287-
// Postgres has a limit of 65535 values in a single IN list
287+
// List size exceeds the implementation's 65000-parameter chunk limit, forcing multiple chunked queries
288288
$name = 'as_' . $i;
289289
$dn = 'uid=' . $name . ',dc=example,dc=org';
290290
$listOfDNs[] = $dn;
291-
if ($i % 20 === 0) {
291+
if ($i % 5000 === 0) {
292292
$mapper->map($dn, $name, 'fake-uuid-' . $i);
293293
}
294294
}
295295

296296
$result = $mapper->getListOfIdsByDn($listOfDNs);
297-
$this->assertCount(66640 / 20, $result);
297+
$this->assertCount(14, $result);
298298
}
299299
}

0 commit comments

Comments
 (0)