Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Oct 20, 2023
1 parent 1d12a9b commit 313d136
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
9 changes: 0 additions & 9 deletions test/xandra_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,6 @@ defmodule XandraTest do
end
end

describe "prepare/3" do
test "supports the :timeout option", %{conn: conn} do
assert {:error, %ConnectionError{} = error} =
Xandra.prepare(conn, "SELECT * FROM system.local", timeout: 0)

assert error.reason == :timeout
end
end

describe "failure handling" do
test "reconnects if the connection drops", %{start_options: start_options} do
telemetry_ref =
Expand Down
14 changes: 14 additions & 0 deletions test/xandra_toxiproxy_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ defmodule XandraToxiproxyTest do
end)
end

test "prepare/3 supports the :timeout option", %{start_options: opts} do
opts = Keyword.merge(opts, nodes: ["127.0.0.1:19052"])
conn = start_supervised!({Xandra, opts})

ToxiproxyEx.get!(:xandra_test_cassandra)
|> ToxiproxyEx.toxic(:timeout, timeout: 100)
|> ToxiproxyEx.apply!(fn ->
assert {:error, %ConnectionError{} = error} =
Xandra.prepare(conn, "SELECT * FROM system.local", timeout: 0)

assert error.reason == :timeout
end)
end

test "start_link/1 supports the :connect_timeout option", %{start_options: opts} do
opts =
Keyword.merge(opts,
Expand Down

0 comments on commit 313d136

Please sign in to comment.