Skip to content

Commit c95d42b

Browse files
committed
use different port
1 parent 86d5e26 commit c95d42b

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

packages/node/test/integrations/undici.test.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ let hub: Hub;
1515
let fetch: typeof FetchType;
1616

1717
beforeAll(async () => {
18-
await setupTestServer();
1918
try {
19+
await setupTestServer();
2020
// need to conditionally require `undici` because it's not available in Node 10
2121
// eslint-disable-next-line @typescript-eslint/no-var-requires
2222
fetch = require('undici').fetch;
@@ -51,10 +51,10 @@ conditionalTest({ min: 16 })('Undici integration', () => {
5151
it.each([
5252
[
5353
'simple url',
54-
'http://localhost:18099',
54+
'http://localhost:18100',
5555
undefined,
5656
{
57-
description: 'GET http://localhost:18099/',
57+
description: 'GET http://localhost:18100/',
5858
op: 'http.client',
5959
data: expect.objectContaining({
6060
'http.method': 'GET',
@@ -63,10 +63,10 @@ conditionalTest({ min: 16 })('Undici integration', () => {
6363
],
6464
[
6565
'url with query',
66-
'http://localhost:18099?foo=bar',
66+
'http://localhost:18100?foo=bar',
6767
undefined,
6868
{
69-
description: 'GET http://localhost:18099/',
69+
description: 'GET http://localhost:18100/',
7070
op: 'http.client',
7171
data: expect.objectContaining({
7272
'http.method': 'GET',
@@ -76,32 +76,32 @@ conditionalTest({ min: 16 })('Undici integration', () => {
7676
],
7777
[
7878
'url with POST method',
79-
'http://localhost:18099',
79+
'http://localhost:18100',
8080
{ method: 'POST' },
8181
{
82-
description: 'POST http://localhost:18099/',
82+
description: 'POST http://localhost:18100/',
8383
data: expect.objectContaining({
8484
'http.method': 'POST',
8585
}),
8686
},
8787
],
8888
[
8989
'url with POST method',
90-
'http://localhost:18099',
90+
'http://localhost:18100',
9191
{ method: 'POST' },
9292
{
93-
description: 'POST http://localhost:18099/',
93+
description: 'POST http://localhost:18100/',
9494
data: expect.objectContaining({
9595
'http.method': 'POST',
9696
}),
9797
},
9898
],
9999
[
100100
'url with GET as default',
101-
'http://localhost:18099',
101+
'http://localhost:18100',
102102
{ method: undefined },
103103
{
104-
description: 'GET http://localhost:18099/',
104+
description: 'GET http://localhost:18100/',
105105
},
106106
],
107107
])('creates a span with a %s', async (_: string, request, requestInit, expected) => {
@@ -182,11 +182,11 @@ conditionalTest({ min: 16 })('Undici integration', () => {
182182

183183
const undoPatch = patchUndici({ shouldCreateSpanForRequest: url => url.includes('yes') });
184184

185-
await fetch('http://localhost:18099/no', { method: 'POST' });
185+
await fetch('http://localhost:18100/no', { method: 'POST' });
186186

187187
expect(transaction.spanRecorder?.spans.length).toBe(1);
188188

189-
await fetch('http://localhost:18099/yes', { method: 'POST' });
189+
await fetch('http://localhost:18100/yes', { method: 'POST' });
190190

191191
expect(transaction.spanRecorder?.spans.length).toBe(2);
192192

@@ -200,7 +200,7 @@ conditionalTest({ min: 16 })('Undici integration', () => {
200200
const transaction = hub.startTransaction({ name: 'test-transaction' }) as Transaction;
201201
hub.getScope().setSpan(transaction);
202202

203-
await fetch('http://localhost:18099', { method: 'POST' });
203+
await fetch('http://localhost:18100', { method: 'POST' });
204204

205205
expect(transaction.spanRecorder?.spans.length).toBe(2);
206206
const span = transaction.spanRecorder?.spans[1];
@@ -215,7 +215,7 @@ conditionalTest({ min: 16 })('Undici integration', () => {
215215
it('attaches the sentry trace and baggage headers if there is no active span', async () => {
216216
const scope = hub.getScope();
217217

218-
await fetch('http://localhost:18099', { method: 'POST' });
218+
await fetch('http://localhost:18100', { method: 'POST' });
219219

220220
const propagationContext = scope.getPropagationContext();
221221

@@ -234,15 +234,15 @@ conditionalTest({ min: 16 })('Undici integration', () => {
234234

235235
const undoPatch = patchUndici({ shouldCreateSpanForRequest: url => url.includes('yes') });
236236

237-
await fetch('http://localhost:18099/no', { method: 'POST' });
237+
await fetch('http://localhost:18100/no', { method: 'POST' });
238238

239239
expect(requestHeaders['sentry-trace']).toBeDefined();
240240
expect(requestHeaders['baggage']).toBeDefined();
241241

242242
expect(requestHeaders['sentry-trace'].includes(propagationContext.traceId)).toBe(true);
243243
const firstSpanId = requestHeaders['sentry-trace'].split('-')[1];
244244

245-
await fetch('http://localhost:18099/yes', { method: 'POST' });
245+
await fetch('http://localhost:18100/yes', { method: 'POST' });
246246

247247
expect(requestHeaders['sentry-trace']).toBeDefined();
248248
expect(requestHeaders['baggage']).toBeDefined();
@@ -264,14 +264,14 @@ conditionalTest({ min: 16 })('Undici integration', () => {
264264

265265
expect(transaction.spanRecorder?.spans.length).toBe(1);
266266

267-
await fetch('http://localhost:18099/no', { method: 'POST' });
267+
await fetch('http://localhost:18100/no', { method: 'POST' });
268268

269269
expect(transaction.spanRecorder?.spans.length).toBe(2);
270270

271271
expect(requestHeaders['sentry-trace']).toBeUndefined();
272272
expect(requestHeaders['baggage']).toBeUndefined();
273273

274-
await fetch('http://localhost:18099/yes', { method: 'POST' });
274+
await fetch('http://localhost:18100/yes', { method: 'POST' });
275275

276276
expect(transaction.spanRecorder?.spans.length).toBe(3);
277277

@@ -290,7 +290,7 @@ conditionalTest({ min: 16 })('Undici integration', () => {
290290
data: {
291291
method: 'POST',
292292
status_code: 200,
293-
url: 'http://localhost:18099/',
293+
url: 'http://localhost:18100/',
294294
},
295295
type: 'http',
296296
timestamp: expect.any(Number),
@@ -300,7 +300,7 @@ conditionalTest({ min: 16 })('Undici integration', () => {
300300
});
301301
hub.bindClient(client);
302302

303-
await fetch('http://localhost:18099', { method: 'POST' });
303+
await fetch('http://localhost:18100', { method: 'POST' });
304304
});
305305

306306
it('adds a breadcrumb on errored request', async () => {
@@ -336,7 +336,7 @@ conditionalTest({ min: 16 })('Undici integration', () => {
336336

337337
const undoPatch = patchUndici({ breadcrumbs: false });
338338

339-
await fetch('http://localhost:18099', { method: 'POST' });
339+
await fetch('http://localhost:18100', { method: 'POST' });
340340

341341
undoPatch();
342342
});
@@ -382,7 +382,7 @@ function setupTestServer() {
382382
res.connection?.end();
383383
});
384384

385-
testServer?.listen(18099, 'localhost');
385+
testServer?.listen(18100);
386386

387387
return new Promise(resolve => {
388388
testServer?.on('listening', resolve);

0 commit comments

Comments
 (0)