Skip to content

Commit

Permalink
test(ext/node): fix flaky node/http2.createServer() test (#27208)
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k authored and bartlomieju committed Dec 5, 2024
1 parent b732750 commit 327f11f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/unit_node/http2_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,18 @@ 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");
res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
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([
Expand Down

0 comments on commit 327f11f

Please sign in to comment.