Skip to content

Commit 853f968

Browse files
committed
fix dupe key error
1 parent a773188 commit 853f968

File tree

3 files changed

+5
-43
lines changed

3 files changed

+5
-43
lines changed

test/integration/enumerate_indexes.test.ts

-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ import { TestBuilder, UnifiedTestSuiteBuilder } from '../tools/utils';
22

33
new UnifiedTestSuiteBuilder('listIndexes with comment option')
44
.createEntities(UnifiedTestSuiteBuilder.defaultEntities)
5-
.initialData({
6-
collectionName: 'collection0',
7-
databaseName: 'database0',
8-
documents: [{ _id: 1, x: 11 }]
9-
})
105
.test(
116
new TestBuilder('listIndexes should not send comment for server versions < 4.4')
127
.runOnRequirement({ maxServerVersion: '4.3.99' })

test/integration/node-specific/comment_with_falsy_values.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ new UnifiedTestSuiteBuilder('Comment with Falsy Values')
6262
.createEntities(UnifiedTestSuiteBuilder.defaultEntities)
6363
.initialData({
6464
collectionName: 'collection0',
65-
databaseName: '',
65+
databaseName: 'database0',
6666
documents: [
6767
{ _id: 1, x: 11 },
6868
{ _id: 2, toBeDeleted: true } // This should only be used by the delete test

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

+4-37
Original file line numberDiff line numberDiff line change
@@ -324,22 +324,6 @@ export class EntitiesMap<E = Entity> extends Map<string, E> {
324324
await session.endSession({ force: true });
325325
}
326326

327-
trace('drop namespaces');
328-
for (const [, db] of this.mapOf('db')) {
329-
if (['admin', 'local', 'config'].includes(db.databaseName)) {
330-
continue;
331-
}
332-
expect(await db.dropDatabase()).to.be.true;
333-
}
334-
335-
trace('drop namespaces');
336-
for (const [, db] of this.mapOf('db')) {
337-
if (['admin', 'local', 'config'].includes(db.databaseName)) {
338-
continue;
339-
}
340-
expect(await db.dropDatabase()).to.be.true;
341-
}
342-
343327
trace('closeClient');
344328
for (const [, client] of this.mapOf('client')) {
345329
await client.close();
@@ -380,20 +364,10 @@ export class EntitiesMap<E = Entity> extends Map<string, E> {
380364
map.set(entity.database.id, db);
381365
} else if ('collection' in entity) {
382366
const db = map.getEntity('db', entity.collection.database);
383-
const collection = await db
384-
.createCollection(
385-
entity.collection.collectionName,
386-
patchCollectionOptions(entity.collection.collectionOptions)
387-
)
388-
.catch(error => {
389-
if (/already exists/.test(error.message)) {
390-
return db.collection(
391-
entity.collection.collectionName,
392-
patchCollectionOptions(entity.collection.collectionOptions)
393-
);
394-
}
395-
throw error;
396-
});
367+
const collection = db.collection(
368+
entity.collection.collectionName,
369+
patchCollectionOptions(entity.collection.collectionOptions)
370+
);
397371
map.set(entity.collection.id, collection);
398372
} else if ('session' in entity) {
399373
const client = map.getEntity('client', entity.session.client);
@@ -453,13 +427,6 @@ export class EntitiesMap<E = Entity> extends Map<string, E> {
453427
throw new Error(`Unsupported Entity ${JSON.stringify(entity)}`);
454428
}
455429
}
456-
457-
// startup events are never part of testing
458-
for (const [, client] of map.mapOf('client')) {
459-
client.commandEvents = [];
460-
// client.cmapEvents = []; TODO connect optional PR
461-
}
462-
463430
return map;
464431
}
465432
}

0 commit comments

Comments
 (0)