test: fix race in test-http2-origin
PR-URL: https://github.com/nodejs/node/pull/28903 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
ab155335bc
commit
985c5f5b7e
@ -88,7 +88,7 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary');
|
|||||||
['https://example.org', 'https://example.com']
|
['https://example.org', 'https://example.com']
|
||||||
];
|
];
|
||||||
|
|
||||||
const countdown = new Countdown(2, () => {
|
const countdown = new Countdown(3, () => {
|
||||||
client.close();
|
client.close();
|
||||||
server.close();
|
server.close();
|
||||||
});
|
});
|
||||||
@ -101,7 +101,7 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary');
|
|||||||
countdown.dec();
|
countdown.dec();
|
||||||
}, 2));
|
}, 2));
|
||||||
|
|
||||||
client.request().on('close', mustCall()).resume();
|
client.request().on('close', mustCall(() => countdown.dec())).resume();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,15 +119,19 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary');
|
|||||||
const originSet = [`https://localhost:${server.address().port}`];
|
const originSet = [`https://localhost:${server.address().port}`];
|
||||||
const client = connect(originSet[0], { ca });
|
const client = connect(originSet[0], { ca });
|
||||||
|
|
||||||
|
const countdown = new Countdown(2, () => {
|
||||||
|
client.close();
|
||||||
|
server.close();
|
||||||
|
});
|
||||||
|
|
||||||
client.on('origin', mustCall((origins) => {
|
client.on('origin', mustCall((origins) => {
|
||||||
originSet.push(...check);
|
originSet.push(...check);
|
||||||
deepStrictEqual(client.originSet, originSet);
|
deepStrictEqual(client.originSet, originSet);
|
||||||
deepStrictEqual(origins, check);
|
deepStrictEqual(origins, check);
|
||||||
client.close();
|
countdown.dec();
|
||||||
server.close();
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
client.request().on('close', mustCall()).resume();
|
client.request().on('close', mustCall(() => countdown.dec())).resume();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user