Skip to content

Commit 8920ddf

Browse files
authored
test: fix mongo test skip logic when there's no DB instance running (#439)
1 parent 60dd7d1 commit 8920ddf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/node/opentelemetry-instrumentation-mongodb/test/mongodb.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ describe('MongoDBInstrumentation', () => {
6262
instrumentation.setTracerProvider(provider);
6363
provider.addSpanProcessor(spanProcessor);
6464
context.setGlobalContextManager(contextManager);
65+
shouldTest = true;
6566
accessCollection(URL, DB_NAME, COLLECTION_NAME)
6667
.then(result => {
6768
client = result.client;
@@ -97,8 +98,11 @@ describe('MongoDBInstrumentation', () => {
9798
});
9899

99100
afterEach(done => {
100-
collection.deleteMany({}, done);
101101
memoryExporter.reset();
102+
if (shouldTest) {
103+
return collection.deleteMany({}, done);
104+
}
105+
done();
102106
});
103107

104108
after(() => {

0 commit comments

Comments
 (0)