Skip to content

Commit 13500c4

Browse files
committed
mongodb test
1 parent f22e055 commit 13500c4

File tree

3 files changed

+21
-33
lines changed

3 files changed

+21
-33
lines changed

packages/instrumentation-mongodb/test/mongodb-v3.test.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -681,17 +681,13 @@ describe('MongoDBInstrumentation-Tracing-v3', () => {
681681
instrumentation.setConfig();
682682
});
683683

684-
it('should not create spans without parent span when requireParentSpan is explicitly set to true', done => {
685-
context.with(trace.deleteSpan(context.active()), () => {
686-
collection
687-
.insertOne({ a: 1 })
688-
.then(() => {
689-
assert.strictEqual(getTestSpans().length, 0);
690-
done();
691-
})
692-
.catch(err => {
693-
done(err);
694-
});
684+
it('should not create spans without parent span when requireParentSpan is explicitly set to true', async () => {
685+
await context.with(trace.deleteSpan(context.active()), async () => {
686+
console.log(getTestSpans());
687+
assert.strictEqual(getTestSpans().length, 0);
688+
await collection.insertOne({ a: 1 });
689+
console.log(getTestSpans());
690+
assert.strictEqual(getTestSpans().length, 0);
695691
});
696692
});
697693

packages/instrumentation-mongodb/test/mongodb-v4.test.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -654,17 +654,13 @@ describe('MongoDBInstrumentation-Tracing-v4', () => {
654654
instrumentation.setConfig();
655655
});
656656

657-
it('should not create spans without parent span when requireParentSpan is explicitly set to true', done => {
658-
context.with(trace.deleteSpan(context.active()), () => {
659-
collection
660-
.insertOne({ a: 1 })
661-
.then(() => {
662-
assert.strictEqual(getTestSpans().length, 0);
663-
done();
664-
})
665-
.catch(err => {
666-
done(err);
667-
});
657+
it('should not create spans without parent span when requireParentSpan is explicitly set to true', async () => {
658+
await context.with(trace.deleteSpan(context.active()), async () => {
659+
console.log(getTestSpans());
660+
assert.strictEqual(getTestSpans().length, 0);
661+
await collection.insertOne({ a: 1 });
662+
console.log(getTestSpans());
663+
assert.strictEqual(getTestSpans().length, 0);
668664
});
669665
});
670666

packages/instrumentation-mongodb/test/mongodb-v5-v6.test.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -678,17 +678,13 @@ describe('MongoDBInstrumentation-Tracing-v5', () => {
678678
instrumentation.setConfig();
679679
});
680680

681-
it('should not create spans without parent span when requireParentSpan is explicitly set to true', done => {
682-
context.with(trace.deleteSpan(context.active()), () => {
683-
collection
684-
.insertOne({ a: 1 })
685-
.then(() => {
686-
assert.strictEqual(getTestSpans().length, 0);
687-
done();
688-
})
689-
.catch(err => {
690-
done(err);
691-
});
681+
it('should not create spans without parent span when requireParentSpan is explicitly set to true', async () => {
682+
await context.with(trace.deleteSpan(context.active()), async () => {
683+
console.log(getTestSpans());
684+
assert.strictEqual(getTestSpans().length, 0);
685+
await collection.insertOne({ a: 1 });
686+
console.log(getTestSpans());
687+
assert.strictEqual(getTestSpans().length, 0);
692688
});
693689
});
694690

0 commit comments

Comments
 (0)