-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
32 lines (26 loc) · 1.06 KB
/
test.ts
File metadata and controls
32 lines (26 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { afterAll, expect, test } from 'vitest';
import { cleanupChildProcesses, createRunner } from '../../../../utils/runner';
afterAll(() => {
cleanupChildProcesses();
});
test('sends manually started streamed parallel root spans in root context', async () => {
expect.assertions(7);
await createRunner(__dirname, 'scenario.ts')
.expect({ span: { items: [{ name: 'test_span_1' }] } })
.expect({
span: spanContainer => {
expect(spanContainer).toBeDefined();
const traceId = spanContainer.items[0]!.trace_id;
expect(traceId).toMatch(/^[0-9a-f]{32}$/);
// It ignores propagation context of the root context
expect(traceId).not.toBe('12345678901234567890123456789012');
expect(spanContainer.items[0]!.parent_span_id).toBeUndefined();
// Different trace ID than the first span
const trace1Id = spanContainer.items[0]!.attributes?.spanIdTraceId?.value;
expect(trace1Id).toMatch(/^[0-9a-f]{32}$/);
expect(trace1Id).not.toBe(traceId);
},
})
.start()
.completed();
});