Skip to content

Commit 39b6e9b

Browse files
fix drop logic
1 parent 3c3e6e0 commit 39b6e9b

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

test/tools/unified-spec-runner/runner.ts

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,29 @@ async function runUnifiedTest(
143143
trace('initialData');
144144
for (const { databaseName, collectionName } of unifiedSuite.initialData) {
145145
const db = utilClient.db(databaseName);
146-
const collection = db.collection(collectionName, {
147-
writeConcern: { w: 'majority' }
148-
});
149146

150-
trace('drop');
151-
expect(
152-
await collection.drop({
153-
// Specifying any encrypted fields causes `collection.drop()` to drop the esoc and esc collections as well.
154-
encryptedFields: {}
155-
})
156-
).to.be.true;
147+
trace('listCollections');
148+
const allCollections = new Set(
149+
await db
150+
.listCollections()
151+
.map(({ name }) => name)
152+
.toArray()
153+
);
154+
155+
const collections = [
156+
collectionName,
157+
`enxcol_.${collectionName}.esc`,
158+
`enxcol_.${collectionName}.ecoc`
159+
].filter(allCollections.has.bind(allCollections));
160+
161+
for (const name of collections) {
162+
const collection = db.collection(name, {
163+
writeConcern: { w: 'majority' }
164+
});
165+
166+
trace('drop');
167+
expect(await collection.drop()).to.be.true;
168+
}
157169
}
158170

159171
for (const {

0 commit comments

Comments
 (0)