tests/fuzz: tighten the listIndexes NamespaceNotFound comment
Comment-only cleanup: the six-line rationale restated the scenario twice (first-cycle crash at prefix 0 = kill during the first in-flight command on a fresh log) and echoed 'expected state' with 'exactly the case worth verifying'. Four lines keep all three points: real MongoDB answers NamespaceNotFound too, it is expected when nothing durable created the collection, and treating it as a harness error broke verification of that case.
This commit is contained in:
@@ -498,12 +498,10 @@ async function verify(client, base, r, cycleNo) {
|
|||||||
const coll = db.collection('c');
|
const coll = db.collection('c');
|
||||||
const dbDocs = await coll.find({}, { sort: { _id: 1 } }).toArray();
|
const dbDocs = await coll.find({}, { sort: { _id: 1 } }).toArray();
|
||||||
const dbMap = new Map(dbDocs.map((d) => [d._id, d]));
|
const dbMap = new Map(dbDocs.map((d) => [d._id, d]));
|
||||||
// `listIndexes` on a namespace that does not exist is NamespaceNotFound, which
|
// listIndexes on a nonexistent namespace answers NamespaceNotFound, as real
|
||||||
// is what real MongoDB answers too -- and it is the *expected* state whenever
|
// MongoDB does too -- the expected state when a kill lands during the first
|
||||||
// the surviving prefix contains no write that created the collection (a kill
|
// in-flight command on a fresh log. Treating it as a harness error made seeds
|
||||||
// during the first in-flight command on a fresh log). Treating it as a harness
|
// that crashed at prefix 0 abort instead of verifying.
|
||||||
// error made any seed whose first cycle crashed at prefix 0 abort the run
|
|
||||||
// instead of verifying it, which is exactly the case worth verifying.
|
|
||||||
const dbIndexes = await coll.indexes().catch((e) => {
|
const dbIndexes = await coll.indexes().catch((e) => {
|
||||||
if (e.code === 26 || /ns not found|NamespaceNotFound/i.test(e.message)) return [];
|
if (e.code === 26 || /ns not found|NamespaceNotFound/i.test(e.message)) return [];
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
Reference in New Issue
Block a user