Skip to content

Commit 45863cd

Browse files
committed
ignore dropping error
1 parent a7f4324 commit 45863cd

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

test/integration/node-specific/examples/change_streams.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ maybeDescribe('examples(change-stream):', function () {
6060
it('Open A Change Stream', {
6161
metadata: { requires: { topology: ['replicaset'], mongodb: '>=3.6.0' } },
6262
test: async function () {
63-
const looper = new Looper(() => db.collection('inventory').insertOne({ a: 1 }));
63+
const looper = new Looper(async () => {
64+
await db.collection('inventory').insertOne({ a: 1 });
65+
});
6466
looper.run();
6567

6668
// Start Changestream Example 1

test/integration/shared.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,14 @@ async function setupDatabase(configuration, dbsToClean) {
9999
const client = configuration.newClient(configuration.writeConcernMax());
100100
try {
101101
for (const dbName of dbsToClean) {
102-
await client.db(dbName).command({ dropAllUsersFromDatabase: 1, writeConcern: { w: 1 } });
103-
await client.db(dbName).dropDatabase({ writeConcern: { w: 1 } });
102+
await client
103+
.db(dbName)
104+
.command({ dropAllUsersFromDatabase: 1, writeConcern: { w: 'majority' } });
105+
try {
106+
await client.db(dbName).dropDatabase({ writeConcern: { w: 'majority' } });
107+
} catch (error) {
108+
if (!error.message.match(/database is currently being dropped/)) throw error;
109+
}
104110
}
105111
} finally {
106112
await client.close();

0 commit comments

Comments
 (0)