Skip to content

Commit 1d60ba0

Browse files
committed
Revert "test"
This reverts commit bcf0185.
1 parent bcf0185 commit 1d60ba0

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

metapackages/auto-instrumentations-node/test/register.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('Register', function () {
9090
it('shuts down the NodeSDK when SIGTERM is received', async () => {
9191
const runPromise = runWithRegister('./test-app/app-server.js');
9292
const { child } = runPromise;
93-
await waitForString(child.stdout!, 'Finished request');
93+
await waitForString(child.stdout!, 'Finshed request');
9494
child.kill('SIGTERM');
9595
const { stdout } = await runPromise;
9696

metapackages/auto-instrumentations-node/test/test-app/app-server.js

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,22 @@
1717
//Used in register.test.ts to mimic a JS app that stays alive like a server.
1818
const http = require('http');
1919

20-
// Create a local server that responds immediately
21-
const server = http.createServer((req, res) => {
22-
res.end('ok');
23-
});
24-
25-
server.listen(0, () => {
26-
const port = server.address().port;
27-
const req = http.request({
28-
hostname: 'localhost',
29-
port: port,
30-
path: '/',
31-
method: 'GET',
32-
});
20+
const options = {
21+
hostname: 'example.com',
22+
port: 80,
23+
path: '/',
24+
method: 'GET',
25+
};
3326

34-
req.end();
35-
req.on('response', res => {
36-
res.on('end', () => {
37-
console.log('Finished request');
38-
});
39-
res.resume();
40-
});
27+
const req = http.request(options);
28+
req.end();
29+
req.on('close', () => {
30+
console.log('Finshed request');
4131
});
4232

4333
// Make sure there is work on the event loop
4434
const handle = setInterval(() => {}, 1);
45-
4635
// Gracefully shut down
4736
process.on('SIGTERM', () => {
4837
clearInterval(handle);
49-
server.close();
5038
});

0 commit comments

Comments
 (0)