Skip to content

Commit b7deb1f

Browse files
nicohrubeccodex
andauthored
test(node): Port parallel span and naming tests to streaming (#25217)
Exercise parallel root spans and span renaming with the default streaming lifecycle. Consolidate the matching streamed suites. Part of #24140 Co-authored-by: GPT-6 <codex@openai.com>
1 parent 6706e75 commit b7deb1f

20 files changed

Lines changed: 62 additions & 335 deletions

File tree

‎dev-packages/node-integration-tests/suites/public-api/startSpan/parallel-root-spans-streamed/scenario.ts‎

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎dev-packages/node-integration-tests/suites/public-api/startSpan/parallel-root-spans-streamed/test.ts‎

Lines changed: 0 additions & 31 deletions
This file was deleted.

‎dev-packages/node-integration-tests/suites/public-api/startSpan/parallel-root-spans/scenario.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node';
22
import { loggingTransport } from '@sentry-internal/node-integration-tests';
33

44
Sentry.init({
5-
traceLifecycle: 'static',
65
dsn: 'https://public@dsn.ingest.sentry.io/1337',
76
release: '1.0',
87
tracesSampleRate: 1.0,

‎dev-packages/node-integration-tests/suites/public-api/startSpan/parallel-root-spans/test.ts‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ afterAll(() => {
66
});
77

88
test('should send manually started parallel root spans in root context', async () => {
9-
expect.assertions(6);
10-
119
await createRunner(__dirname, 'scenario.ts')
12-
.expect({ transaction: { transaction: 'test_span_1' } })
1310
.expect({
14-
transaction: transaction => {
15-
expect(transaction).toBeDefined();
16-
const traceId = transaction.contexts?.trace?.trace_id;
11+
span: container => {
12+
const span1 = container.items.find(span => span.name === 'test_span_1');
13+
const span2 = container.items.find(span => span.name === 'test_span_2');
14+
expect(span1?.is_segment).toBe(true);
15+
expect(span2?.is_segment).toBe(true);
16+
expect(span1?.start_timestamp).toEqual(expect.any(Number));
17+
expect(span1?.end_timestamp).toEqual(expect.any(Number));
1718

18-
// Both root spans continue the scope's propagation context, matching the core SDK behavior.
19-
expect(traceId).toBe('12345678901234567890123456789012');
20-
expect(transaction.contexts?.trace?.parent_span_id).toBe('1234567890123456');
19+
// Both root spans continue the scope's propagation context, including the parentSpanId.
20+
expect(span1?.trace_id).toBe('12345678901234567890123456789012');
21+
expect(span1?.parent_span_id).toBe('1234567890123456');
22+
expect(span2?.parent_span_id).toBe('1234567890123456');
2123

22-
// Same trace ID as the first span
23-
const trace1Id = transaction.contexts?.trace?.data?.spanIdTraceId;
24-
expect(trace1Id).toBe('12345678901234567890123456789012');
25-
expect(trace1Id).toBe(traceId);
24+
expect(span2?.trace_id).toBe(span1?.trace_id);
25+
expect(span2?.attributes.spanIdTraceId).toEqual({ type: 'string', value: span1?.trace_id });
2626
},
2727
})
2828
.start()

‎dev-packages/node-integration-tests/suites/public-api/startSpan/parallel-spans-in-scope-streamed/scenario.ts‎

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎dev-packages/node-integration-tests/suites/public-api/startSpan/parallel-spans-in-scope-streamed/test.ts‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎dev-packages/node-integration-tests/suites/public-api/startSpan/parallel-spans-in-scope-with-parentSpanId-streamed/scenario.ts‎

Lines changed: 0 additions & 35 deletions
This file was deleted.

‎dev-packages/node-integration-tests/suites/public-api/startSpan/parallel-spans-in-scope-with-parentSpanId-streamed/test.ts‎

Lines changed: 0 additions & 32 deletions
This file was deleted.

‎dev-packages/node-integration-tests/suites/public-api/startSpan/parallel-spans-in-scope-with-parentSpanId/scenario.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node';
22
import { loggingTransport } from '@sentry-internal/node-integration-tests';
33

44
Sentry.init({
5-
traceLifecycle: 'static',
65
dsn: 'https://public@dsn.ingest.sentry.io/1337',
76
release: '1.0',
87
tracesSampleRate: 1.0,

‎dev-packages/node-integration-tests/suites/public-api/startSpan/parallel-spans-in-scope-with-parentSpanId/test.ts‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,22 @@ afterAll(() => {
77

88
test('should send manually started parallel root spans outside of root context with parentSpanId', async () => {
99
await createRunner(__dirname, 'scenario.ts')
10-
.expect({ transaction: { transaction: 'test_span_1' } })
1110
.expect({
12-
transaction: transaction => {
13-
expect(transaction).toBeDefined();
14-
const traceId = transaction.contexts?.trace?.trace_id;
11+
span: container => {
12+
const span1 = container.items.find(span => span.name === 'test_span_1');
13+
const span2 = container.items.find(span => span.name === 'test_span_2');
14+
expect(span1?.is_segment).toBe(true);
15+
expect(span2?.is_segment).toBe(true);
16+
expect(span1?.start_timestamp).toEqual(expect.any(Number));
17+
expect(span1?.end_timestamp).toEqual(expect.any(Number));
1518

16-
// Both root spans continue the scope's propagation context, including the parentSpanId,
17-
// matching the core SDK behavior.
18-
expect(traceId).toBe('12345678901234567890123456789012');
19-
expect(transaction.contexts?.trace?.parent_span_id).toBe('1234567890123456');
19+
// Both root spans continue the scope's propagation context, including the parentSpanId.
20+
expect(span1?.trace_id).toBe('12345678901234567890123456789012');
21+
expect(span1?.parent_span_id).toBe('1234567890123456');
22+
expect(span2?.parent_span_id).toBe('1234567890123456');
2023

21-
// Same trace ID as the first span
22-
const trace1Id = transaction.contexts?.trace?.data?.spanIdTraceId;
23-
expect(trace1Id).toBe(traceId);
24+
expect(span2?.trace_id).toBe(span1?.trace_id);
25+
expect(span2?.attributes.spanIdTraceId).toEqual({ type: 'string', value: span1?.trace_id });
2426
},
2527
})
2628
.start()

0 commit comments

Comments
 (0)