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`.
This commit is contained in:
@@ -413,7 +413,13 @@ async function runOperation(op, entities) {
|
|||||||
case 'findOneAndDelete': return unwrapFam(await target.findOneAndDelete(args.filter, options(args)));
|
case 'findOneAndDelete': return unwrapFam(await target.findOneAndDelete(args.filter, options(args)));
|
||||||
|
|
||||||
// -- collection / index management ----------------------------------
|
// -- 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 'dropIndex': return await target.dropIndex(args.name, options(args));
|
||||||
case 'createCollection': return void (await target.createCollection(args.collection, options(args, ['collection'])));
|
case 'createCollection': return void (await target.createCollection(args.collection, options(args, ['collection'])));
|
||||||
case 'dropCollection': return void (await target.dropCollection(args.collection, options(args, ['collection'])));
|
case 'dropCollection': return void (await target.dropCollection(args.collection, options(args, ['collection'])));
|
||||||
|
|||||||
Reference in New Issue
Block a user