Skip to content

Commit 47d9427

Browse files
nicohrubecclaude
andauthored
test(nextjs): Fix flaky node runtime metrics E2E tests (#20624)
Replace `request.get()` with `fetch()` for the server warmup calls in the nextjs-16 runtime metrics tests. All these flakes fail this initial request. The same runtime metrics tests also exists for `node-express-v5`, which hasn't flaked so far. That one uses `fetch()` for this request so I suspect that this might explain the flakiness. Closes #20590 Closes #20414 Closes #20565 Closes #20560 Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 9956476 commit 47d9427

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

dev-packages/e2e-tests/test-applications/nextjs-16/tests/node-runtime-metrics.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const EXPECTED_ATTRIBUTES = {
88
'sentry.origin': { value: 'auto.node.runtime_metrics', type: 'string' },
99
};
1010

11-
test('Should emit node runtime memory metrics', async ({ request }) => {
11+
test('Should emit node runtime memory metrics', async ({ baseURL }) => {
1212
const rssPromise = waitForMetric('nextjs-16', metric => {
1313
return metric.name === 'node.runtime.mem.rss';
1414
});
@@ -22,7 +22,7 @@ test('Should emit node runtime memory metrics', async ({ request }) => {
2222
});
2323

2424
// Trigger a request to ensure the server is running and metrics start being collected
25-
await request.get('/');
25+
await fetch(`${baseURL}/`);
2626

2727
const rss = await rssPromise;
2828
const heapUsed = await heapUsedPromise;
@@ -59,12 +59,12 @@ test('Should emit node runtime memory metrics', async ({ request }) => {
5959
});
6060
});
6161

62-
test('Should emit node runtime CPU utilization metric', async ({ request }) => {
62+
test('Should emit node runtime CPU utilization metric', async ({ baseURL }) => {
6363
const cpuUtilPromise = waitForMetric('nextjs-16', metric => {
6464
return metric.name === 'node.runtime.cpu.utilization';
6565
});
6666

67-
await request.get('/');
67+
await fetch(`${baseURL}/`);
6868

6969
const cpuUtil = await cpuUtilPromise;
7070

@@ -78,7 +78,7 @@ test('Should emit node runtime CPU utilization metric', async ({ request }) => {
7878
});
7979
});
8080

81-
test('Should emit node runtime event loop metrics', async ({ request }) => {
81+
test('Should emit node runtime event loop metrics', async ({ baseURL }) => {
8282
const elDelayP50Promise = waitForMetric('nextjs-16', metric => {
8383
return metric.name === 'node.runtime.event_loop.delay.p50';
8484
});
@@ -91,7 +91,7 @@ test('Should emit node runtime event loop metrics', async ({ request }) => {
9191
return metric.name === 'node.runtime.event_loop.utilization';
9292
});
9393

94-
await request.get('/');
94+
await fetch(`${baseURL}/`);
9595

9696
const elDelayP50 = await elDelayP50Promise;
9797
const elDelayP99 = await elDelayP99Promise;
@@ -127,12 +127,12 @@ test('Should emit node runtime event loop metrics', async ({ request }) => {
127127
});
128128
});
129129

130-
test('Should emit node runtime uptime counter', async ({ request }) => {
130+
test('Should emit node runtime uptime counter', async ({ baseURL }) => {
131131
const uptimePromise = waitForMetric('nextjs-16', metric => {
132132
return metric.name === 'node.runtime.process.uptime';
133133
});
134134

135-
await request.get('/');
135+
await fetch(`${baseURL}/`);
136136

137137
const uptime = await uptimePromise;
138138

0 commit comments

Comments
 (0)