mirror of
https://github.com/denoland/deno.git
synced 2024-12-18 21:35:31 -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.
|
// TODO(satyarohith): enable the test on windows.
|
||||||
ignore: Deno.build.os === "windows",
|
ignore: Deno.build.os === "windows",
|
||||||
}, async () => {
|
}, async () => {
|
||||||
|
const serverListening = Promise.withResolvers<number>();
|
||||||
const server = http2.createServer((_req, res) => {
|
const server = http2.createServer((_req, res) => {
|
||||||
res.setHeader("Content-Type", "text/html");
|
res.setHeader("Content-Type", "text/html");
|
||||||
res.setHeader("X-Foo", "bar");
|
res.setHeader("X-Foo", "bar");
|
||||||
|
@ -159,8 +160,10 @@ Deno.test("[node/http2.createServer()]", {
|
||||||
res.write("Hello, World!");
|
res.write("Hello, World!");
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
server.listen(0);
|
server.listen(0, () => {
|
||||||
const port = (server.address() as net.AddressInfo).port;
|
serverListening.resolve((server.address() as net.AddressInfo).port);
|
||||||
|
});
|
||||||
|
const port = await serverListening.promise;
|
||||||
const endpoint = `http://localhost:${port}`;
|
const endpoint = `http://localhost:${port}`;
|
||||||
|
|
||||||
const response = await curlRequest([
|
const response = await curlRequest([
|
||||||
|
|
Loading…
Reference in a new issue