Skip to content

Commit

Permalink
test: make less likely that test run into :eaddrinuse failure
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed Nov 13, 2024
1 parent a5da3ce commit d88741b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/bandit/server_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defmodule ServerTest do
end

test "server logs connection error detail log at startup" do
pid = start_supervised!({Bandit, scheme: :http, plug: __MODULE__})
pid = start_supervised!({Bandit, scheme: :http, plug: __MODULE__, port: 40_000})
{:ok, {address, port}} = ThousandIsland.listener_info(pid)

logs =
Expand Down Expand Up @@ -56,11 +56,11 @@ defmodule ServerTest do
end

test "can run multiple instances of Bandit" do
start_supervised({Bandit, plug: __MODULE__, port: 4000})
start_supervised({Bandit, plug: __MODULE__, port: 4001})
start_supervised({Bandit, plug: __MODULE__, port: 40_000})
start_supervised({Bandit, plug: __MODULE__, port: 40_001})

assert 200 == Req.get!("http://localhost:4000/hello").status
assert 200 == Req.get!("http://localhost:4001/hello").status
assert 200 == Req.get!("http://localhost:40000/hello").status
assert 200 == Req.get!("http://localhost:40001/hello").status
end

def hello(conn) do
Expand Down

0 comments on commit d88741b

Please sign in to comment.