Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed May 21, 2024
1 parent 1f6ce27 commit 15bc544
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions packages/core/test/lib/tracing/trace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1598,18 +1598,25 @@ describe('startNewTrace', () => {
getIsolationScope().clear();
});

it('resets the propagation context on current scope and isolation scope', () => {
const oldIsolationScopeItraceId = getIsolationScope().getPropagationContext().traceId;
it('creates a new propagation context on the current scope', () => {
const oldCurrentScopeItraceId = getCurrentScope().getPropagationContext().traceId;

startNewTrace();
startNewTrace(() => {
const newCurrentScopeItraceId = getCurrentScope().getPropagationContext().traceId;

const newIsolationScopeItraceId = getIsolationScope().getPropagationContext().traceId;
const newCurrentScopeItraceId = getCurrentScope().getPropagationContext().traceId;
expect(newCurrentScopeItraceId).toMatch(/^[a-f0-9]{32}$/);
expect(newCurrentScopeItraceId).not.toEqual(oldCurrentScopeItraceId);
});
});

it('keeps the propagation context on the isolation scope as-is', () => {
const oldIsolationScopeTraceId = getIsolationScope().getPropagationContext().traceId;

expect(newIsolationScopeItraceId).toMatch(/^[a-f0-9]{32}$/);
expect(newCurrentScopeItraceId).toMatch(/^[a-f0-9]{32}$/);
expect(newIsolationScopeItraceId).not.toBe(oldIsolationScopeItraceId);
expect(newCurrentScopeItraceId).not.toBe(oldCurrentScopeItraceId);
startNewTrace(() => {
const newIsolationScopeTraceId = getIsolationScope().getPropagationContext().traceId;

expect(newIsolationScopeTraceId).toMatch(/^[a-f0-9]{32}$/);
expect(newIsolationScopeTraceId).toEqual(oldIsolationScopeTraceId);
});
});
});

0 comments on commit 15bc544

Please sign in to comment.