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/examples/tests/curl_test.ts | |
parent | 0adc86f105204b2475126c36dfc10e678f67df56 (diff) |
avoid using same port number for test (#4147)
Diffstat (limited to 'std/examples/tests/curl_test.ts')
-rw-r--r-- | std/examples/tests/curl_test.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/std/examples/tests/curl_test.ts b/std/examples/tests/curl_test.ts index bc413b23f..b23e73210 100644 --- a/std/examples/tests/curl_test.ts +++ b/std/examples/tests/curl_test.ts @@ -1,14 +1,16 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { serve } from "../../http/server.ts"; import { assertStrictEq } from "../../testing/asserts.ts"; +import { randomPort } from "../../http/test_util.ts"; +const port = randomPort(); Deno.test({ name: "[examples/curl] send a request to a specified url", // FIXME(bartlomieju): this test is leaking both resources and ops, // and causes interference with other tests ignore: true, fn: async () => { - const server = serve({ port: 8081 }); + const server = serve({ port }); (async (): Promise<void> => { for await (const req of server) { req.respond({ body: "Hello world" }); @@ -21,7 +23,7 @@ Deno.test({ Deno.execPath(), "--allow-net", "curl.ts", - "http://localhost:8081" + "http://localhost:" + port ], cwd: "examples", stdout: "piped" |