Skip to content

Commit

Permalink
test: test with Node.js 22 (#2350)
Browse files Browse the repository at this point in the history
Also:
- Fix a flaky test failure with socket.io@4.7.4 and node 18, 20, and 22.
  With those Node.js versions the 'traceReserved:true on is instrumented' test
  case in "socket.io.test.ts" would sometimes hang with node 18 and
  (almost?) always hang with node 20 and 22.
- test fix for socket.io@2.x and Node.js 22.
  This is a fix/workaround based on a hunch from the other socket.io.test.ts fix.
  • Loading branch information
trentm authored Jul 31, 2024
1 parent c1d67f8 commit 80304bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-all-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ["14", "16", "18", "20"]
node: ["14", "16", "18", "20", "22"]
runs-on: ubuntu-latest
services:
mongo:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ["14", "16", "18", "20"]
node: ["14", "16", "18", "20", "22"]
include:
- node: 18
code-coverage: true
Expand Down
12 changes: 6 additions & 6 deletions plugins/node/instrumentation-socket.io/test/socket.io.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,18 @@ describe('SocketIoInstrumentation', () => {
createServer((sio, port) => {
const client = io(`http://localhost:${port}`);
sio.on('connection', () => {
client.close();
sio.close();
//trace is created after the listener method is completed
setTimeout(() => {
expectSpan('connection receive', span => {
expect(span.kind).toEqual(SpanKind.CONSUMER);
expect(span.attributes[SEMATTRS_MESSAGING_SYSTEM]).toEqual(
'socket.io'
);
client.close();
sio.close();
done();
});
});
}, 10);
});
});
});
Expand Down Expand Up @@ -417,9 +417,9 @@ describe('SocketIoInstrumentation', () => {
});
sio.on('connection', (socket: Socket) => {
socket.emit('test');
client.close();
sio.close();
setTimeout(() => {
client.close();
sio.close();
expectSpan(
`/[${socket.id}] send`,
span => {
Expand All @@ -435,7 +435,7 @@ describe('SocketIoInstrumentation', () => {
},
2
);
});
}, 10);
});
});
});
Expand Down

0 comments on commit 80304bc

Please sign in to comment.