Skip to content

Commit

Permalink
chore: update test to check context inside http callback
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarchaud committed Oct 6, 2020
1 parent 8bc8019 commit e9e1cbe
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import {
propagation,
Span as ISpan,
SpanKind,
getActiveSpan
} from '@opentelemetry/api';
import { NoopLogger, getActiveSpan } from '@opentelemetry/core';
import { NoopLogger } from '@opentelemetry/core';
import { NodeTracerProvider } from '@opentelemetry/node';
import {
InMemorySpanExporter,
Expand Down Expand Up @@ -710,12 +711,12 @@ describe('HttpPlugin', () => {
);
});

it('should not set span as active in context for outgoing request', async () => {
it('should not set span as active in context for outgoing request', (done) => {
assert.deepStrictEqual(getActiveSpan(context.active()), undefined);
await httpRequest.get(`${protocol}://${hostname}:${serverPort}/test`);
assert.deepStrictEqual(getActiveSpan(context.active()), undefined);
const spans = memoryExporter.getFinishedSpans();
assert.strictEqual(spans.length, 2);
http.get(`${protocol}://${hostname}:${serverPort}/test`, (res) => {
assert.deepStrictEqual(getActiveSpan(context.active()), undefined);
done();
});
});
});

Expand Down

0 comments on commit e9e1cbe

Please sign in to comment.