-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02e24e8
commit 25f4b54
Showing
2 changed files
with
16 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
defmodule Ch.ConnectTest do | ||
use ExUnit.Case, async: true | ||
use ExUnit.Case | ||
import ExUnit.CaptureLog | ||
|
||
@tag :slow | ||
test "retries to connect even with exceptions" do | ||
{:ok, conn} = | ||
Ch.start_link(database: Ch.Test.database(), transport_opts: [sndbuf: nil]) | ||
# See https://github.com/plausible/ch/issues/208 | ||
bad_transport_opts = [sndbuf: nil] | ||
|
||
:timer.sleep(100) | ||
logs = | ||
capture_log(fn -> | ||
{:ok, conn} = | ||
Ch.start_link(database: Ch.Test.database(), transport_opts: bad_transport_opts) | ||
|
||
assert Process.alive?(conn) | ||
:timer.sleep(100) | ||
|
||
assert Process.alive?(conn) | ||
end) | ||
|
||
assert logs =~ "failed to connect: ** (ArgumentError) argument error" | ||
end | ||
end |