diff --git a/tests/fuzz/crash-fuzz.js b/tests/fuzz/crash-fuzz.js index 5b1884b..7c27d68 100644 --- a/tests/fuzz/crash-fuzz.js +++ b/tests/fuzz/crash-fuzz.js @@ -498,7 +498,16 @@ async function verify(client, base, r, cycleNo) { const coll = db.collection('c'); const dbDocs = await coll.find({}, { sort: { _id: 1 } }).toArray(); const dbMap = new Map(dbDocs.map((d) => [d._id, d])); - const dbIndexes = await coll.indexes(); + // `listIndexes` on a namespace that does not exist is NamespaceNotFound, which + // is what real MongoDB answers too -- and it is the *expected* state whenever + // the surviving prefix contains no write that created the collection (a kill + // during the first in-flight command on a fresh log). Treating it as a harness + // 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) => { + if (e.code === 26 || /ns not found|NamespaceNotFound/i.test(e.message)) return []; + throw e; + }); const indexExists = dbIndexes.some((i) => i.name === 'k_1'); if (VERBOSE) { console.log(` [verify] indexes=${JSON.stringify(dbIndexes.map((i) => i.name))} baseIdx=${base.indexCreated} idxPos=${r.idxPos}`);