Skip to content

Commit fd3cea7

Browse files
authored
Fix flaky test in test/request.js (#4353)
1 parent a751e26 commit fd3cea7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/request.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,7 @@ describe('Request', () => {
13951395
it('handles hostname in HTTP request resource', async () => {
13961396

13971397
const server = Hapi.server({ debug: false });
1398+
const team = new Teamwork.Team();
13981399

13991400
let hostname;
14001401
server.route({
@@ -1403,13 +1404,14 @@ describe('Request', () => {
14031404
handler: (request) => {
14041405

14051406
hostname = request.info.hostname;
1407+
team.attend();
14061408
return null;
14071409
}
14081410
});
14091411

14101412
await server.start();
14111413
const socket = Net.createConnection(server.info.port, '127.0.0.1', () => socket.write('GET http://host.com\r\n\r\n'));
1412-
await Hoek.wait(10);
1414+
await team.work;
14131415
socket.destroy();
14141416
await server.stop();
14151417
expect(hostname).to.equal('host.com');

0 commit comments

Comments
 (0)