diff options
| author | Yusuke Sakurai <kerokerokerop@gmail.com> | 2020-03-21 22:53:47 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-21 09:53:47 -0400 |
| commit | 60cee4f045778777a16b6fffd6d5b9a1400d7246 (patch) | |
| tree | a477bd147fbd548d478a289af5bd0681b1a34c4e /std/http/racing_server_test.ts | |
| parent | 0adc86f105204b2475126c36dfc10e678f67df56 (diff) | |
avoid using same port number for test (#4147)
Diffstat (limited to 'std/http/racing_server_test.ts')
| -rw-r--r-- | std/http/racing_server_test.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/std/http/racing_server_test.ts b/std/http/racing_server_test.ts index d82acebab..2f88a4703 100644 --- a/std/http/racing_server_test.ts +++ b/std/http/racing_server_test.ts @@ -1,12 +1,20 @@ import { assert, assertEquals } from "../testing/asserts.ts"; import { BufReader, BufWriter } from "../io/bufio.ts"; import { TextProtoReader } from "../textproto/mod.ts"; +import { randomPort } from "./test_util.ts"; +const port = randomPort(); const { connect, run, test } = Deno; let server: Deno.Process; async function startServer(): Promise<void> { server = run({ - args: [Deno.execPath(), "run", "-A", "http/racing_server.ts"], + args: [ + Deno.execPath(), + "run", + "-A", + "http/racing_server.ts", + "127.0.0.1:" + port + ], stdout: "piped" }); // Once racing server is ready it will write to its stdout. @@ -61,7 +69,7 @@ Step7 test(async function serverPipelineRace(): Promise<void> { await startServer(); - const conn = await connect({ port: 4501 }); + const conn = await connect({ port }); const r = new TextProtoReader(new BufReader(conn)); const w = new BufWriter(conn); await w.write(new TextEncoder().encode(input)); |
