mirror of
https://github.com/denoland/deno.git
synced 2024-12-18 13:22:55 -05:00
test(ext/node): fix flaky node/http2.createServer() test (#27208)
This commit is contained in:
parent
ae5c743f33
commit
3bae68eda6
1 changed files with 5 additions and 2 deletions
|
@ -152,6 +152,7 @@ Deno.test("[node/http2.createServer()]", {
|
|||
// TODO(satyarohith): enable the test on windows.
|
||||
ignore: Deno.build.os === "windows",
|
||||
}, async () => {
|
||||
const serverListening = Promise.withResolvers<number>();
|
||||
const server = http2.createServer((_req, res) => {
|
||||
res.setHeader("Content-Type", "text/html");
|
||||
res.setHeader("X-Foo", "bar");
|
||||
|
@ -159,8 +160,10 @@ Deno.test("[node/http2.createServer()]", {
|
|||
res.write("Hello, World!");
|
||||
res.end();
|
||||
});
|
||||
server.listen(0);
|
||||
const port = (server.address() as net.AddressInfo).port;
|
||||
server.listen(0, () => {
|
||||
serverListening.resolve((server.address() as net.AddressInfo).port);
|
||||
});
|
||||
const port = await serverListening.promise;
|
||||
const endpoint = `http://localhost:${port}`;
|
||||
|
||||
const response = await curlRequest([
|
||||
|
|
Loading…
Reference in a new issue