Skip to content

Commit

Permalink
fix: startactiveSpan test
Browse files Browse the repository at this point in the history
Signed-off-by: naseemkullah <naseem@transit.app>
  • Loading branch information
naseemkullah committed May 22, 2021
1 parent b80b40f commit 230ed4f
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions packages/opentelemetry-tracing/test/Tracer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,20 +228,30 @@ describe('Tracer', () => {
{ sampler: new TestSampler() },
tracerProvider
);
tracer.startActiveSpan('my-span', span => {
assert.strictEqual(getSpan(context.active()), span);
span.end();
});

tracer.startActiveSpan('my-span', {}, span => {
assert.strictEqual(getSpan(context.active()), span);
span.end();
});
assert.strictEqual( tracer.startActiveSpan('my-span', span => {
try {
return 1
} finally {
span.end();
}
}), 1);

tracer.startActiveSpan('my-span', {}, ROOT_CONTEXT, span => {
assert.strictEqual(getSpan(context.active()), span);
span.end();
});
assert.strictEqual( tracer.startActiveSpan('my-span', {}, span => {
try {
return 1
} finally {
span.end();
}
}), 1);

assert.strictEqual( tracer.startActiveSpan('my-span', {}, context.active(), span => {
try {
return 1
} finally {
span.end();
}
}), 1);

});
});

0 comments on commit 230ed4f

Please sign in to comment.