Skip to content

Commit 730532f

Browse files
committed
test fixes
1 parent 18848c8 commit 730532f

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-out/server.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ app.use(cors());
2828
app.get('/test/express', (_req, res) => {
2929
// eslint-disable-next-line deprecation/deprecation
3030
const transaction = Sentry.getCurrentScope().getTransaction();
31-
if (transaction) {
32-
// eslint-disable-next-line deprecation/deprecation
33-
transaction.traceId = '86f39e84263a4de99c326acab3bfe3bd';
34-
}
31+
const traceId = transaction?.spanContext().traceId;
3532
const headers = http.get('http://somewhere.not.sentry/').getHeaders();
36-
33+
if (traceId) {
34+
headers['baggage'] = (headers['baggage'] as string).replace(traceId, '__SENTRY_TRACE_ID__')
35+
}
3736
// Responding with the headers outgoing request headers back to the assertions.
3837
res.send({ test_data: headers });
3938
});

dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-out/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test('should attach a baggage header to an outgoing request.', async () => {
1616
host: 'somewhere.not.sentry',
1717
baggage:
1818
'sentry-environment=prod,sentry-release=1.0,sentry-public_key=public' +
19-
',sentry-trace_id=86f39e84263a4de99c326acab3bfe3bd,sentry-sample_rate=1,sentry-transaction=GET%20%2Ftest%2Fexpress' +
19+
',sentry-trace_id=__SENTRY_TRACE_ID__,sentry-sample_rate=1,sentry-transaction=GET%20%2Ftest%2Fexpress' +
2020
',sentry-sampled=true',
2121
},
2222
});

dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-transaction-name/server.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,9 @@ app.use(cors());
3232
app.get('/test/express', (_req, res) => {
3333
// eslint-disable-next-line deprecation/deprecation
3434
const transaction = Sentry.getCurrentScope().getTransaction();
35-
if (transaction) {
36-
// eslint-disable-next-line deprecation/deprecation
37-
transaction.traceId = '86f39e84263a4de99c326acab3bfe3bd';
38-
transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
39-
}
40-
const headers = http.get('http://somewhere.not.sentry/').getHeaders();
35+
transaction?.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
4136

37+
const headers = http.get('http://somewhere.not.sentry/').getHeaders();
4238
// Responding with the headers outgoing request headers back to the assertions.
4339
res.send({ test_data: headers });
4440
});

packages/core/test/lib/tracing/sentrySpan.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('SentrySpan', () => {
3232
// eslint-disable-next-line deprecation/deprecation
3333
const span2 = span.startChild();
3434
expect(spanToJSON(span2).parent_span_id).toBe(span.spanContext().spanId);
35-
expect(span.spanContext().traceId).toBe(span.spanContext().traceFlags);
35+
expect(span.spanContext().traceId).toBe(span.spanContext().traceId);
3636
expect(spanIsSampled(span2)).toBe(spanIsSampled(span));
3737
});
3838
});

0 commit comments

Comments
 (0)