From dc26c66f4025191e18f1292b57ed54e40be0d12c Mon Sep 17 00:00:00 2001 From: "A.Shakhmatov" Date: Mon, 10 Aug 2026 22:51:18 +0300 Subject: [PATCH] tests/spec: `name` is an option of createIndex, not a positional `POSITIONAL` holds `name` because `dropIndex` takes it as one. `createIndex` does not -- it is an option there, and `options()` was stripping it, so a corpus case asking for a named index silently got a derived one and then disagreed with an expectation recorded from a driver that had been passed the name. Two cases in `tests/spec/indexes/partial.json` failed on exactly that. Put back after the strip rather than removed from the set, because the set is right for every other operation that reads `args.name`. --- tests/spec/run.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/spec/run.js b/tests/spec/run.js index 67322c2..bac3627 100644 --- a/tests/spec/run.js +++ b/tests/spec/run.js @@ -413,7 +413,13 @@ async function runOperation(op, entities) { case 'findOneAndDelete': return unwrapFam(await target.findOneAndDelete(args.filter, options(args))); // -- collection / index management ---------------------------------- - case 'createIndex': return await target.createIndex(args.keys, options(args)); + // `name` is positional for `dropIndex` and an *option* for this one, + // so it is put back after `options` strips it -- without that, a + // corpus asking for a named index silently gets a derived name. + case 'createIndex': return await target.createIndex(args.keys, { + ...options(args), + ...(args.name !== undefined ? { name: args.name } : {}), + }); case 'dropIndex': return await target.dropIndex(args.name, options(args)); case 'createCollection': return void (await target.createCollection(args.collection, options(args, ['collection']))); case 'dropCollection': return void (await target.dropCollection(args.collection, options(args, ['collection'])));