Skip to content

Commit

Permalink
fix: search available port on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveigah committed Nov 27, 2023
1 parent b9f8f73 commit 89401b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/finch/http1/integration_proxy_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ defmodule Finch.HTTP1.IntegrationProxyTest do
alias Finch.HTTP1Server

setup_all do
port = 4004
{:ok, listen_socket} = :ssl.listen(0, mode: :binary)
{:ok, {_address, port}} = :ssl.sockname(listen_socket)
:ssl.close(listen_socket)

# Not quite a proper forward proxy server, but good enough
{:ok, _} = HTTP1Server.start(port)
Expand Down
4 changes: 3 additions & 1 deletion test/finch/http1/integration_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ defmodule Finch.HTTP1.IntegrationTest do
alias Finch.TestHelper

setup_all do
port = 4001
{:ok, listen_socket} = :ssl.listen(0, mode: :binary)
{:ok, {_address, port}} = :ssl.sockname(listen_socket)
:ssl.close(listen_socket)

{:ok, _} = HTTPS1Server.start(port)

Expand Down

0 comments on commit 89401b1

Please sign in to comment.