Skip to content

Commit

Permalink
Revert "test"
Browse files Browse the repository at this point in the history
This reverts commit bcf0185.
  • Loading branch information
garysassano committed Jan 17, 2025
1 parent bcf0185 commit 1d60ba0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('Register', function () {
it('shuts down the NodeSDK when SIGTERM is received', async () => {
const runPromise = runWithRegister('./test-app/app-server.js');
const { child } = runPromise;
await waitForString(child.stdout!, 'Finished request');
await waitForString(child.stdout!, 'Finshed request');
child.kill('SIGTERM');
const { stdout } = await runPromise;

Expand Down
32 changes: 10 additions & 22 deletions metapackages/auto-instrumentations-node/test/test-app/app-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,22 @@
//Used in register.test.ts to mimic a JS app that stays alive like a server.
const http = require('http');

// Create a local server that responds immediately
const server = http.createServer((req, res) => {
res.end('ok');
});

server.listen(0, () => {
const port = server.address().port;
const req = http.request({
hostname: 'localhost',
port: port,
path: '/',
method: 'GET',
});
const options = {
hostname: 'example.com',
port: 80,
path: '/',
method: 'GET',
};

req.end();
req.on('response', res => {
res.on('end', () => {
console.log('Finished request');
});
res.resume();
});
const req = http.request(options);
req.end();
req.on('close', () => {
console.log('Finshed request');
});

// Make sure there is work on the event loop
const handle = setInterval(() => {}, 1);

// Gracefully shut down
process.on('SIGTERM', () => {
clearInterval(handle);
server.close();
});

0 comments on commit 1d60ba0

Please sign in to comment.