Skip to content

Commit

Permalink
Maybe this'll do it
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Aug 10, 2023
1 parent d859de4 commit b3c3fc4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/xandra_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
defmodule XandraTest do
use ExUnit.Case, async: true

import XandraTest.IntegrationCase, only: [default_start_options: 0]

doctest Xandra

describe "options validation in Xandra.start_link/1" do
Expand Down Expand Up @@ -46,12 +48,12 @@ defmodule XandraTest do
end

test "supports DBConnection.status/1 without raising" do
conn = start_supervised!(Xandra)
conn = start_supervised!({Xandra, default_start_options()})
assert DBConnection.status(conn) == :idle
end

test "raises for unsupported DBConnection callbacks" do
conn = start_supervised!(Xandra)
conn = start_supervised!({Xandra, default_start_options()})

assert_raise ArgumentError, "Cassandra doesn't support transactions", fn ->
assert DBConnection.transaction(conn, fn _ -> :ok end)
Expand All @@ -60,12 +62,16 @@ defmodule XandraTest do

@tag :capture_log
test "rescues DBConnection errors" do
conn =
start_supervised!(
{Xandra,
nodes: ["nonexistent-domain"], queue_target: 10, queue_interval: 10, pool_size: 0}
options =
Keyword.merge(default_start_options(),
nodes: ["nonexistent-domain"],
queue_target: 10,
queue_interval: 10,
pool_size: 0
)

conn = start_supervised!({Xandra, options})

assert {:error, %DBConnection.ConnectionError{}} = Xandra.execute(conn, "USE some_keyspace")
end
end

0 comments on commit b3c3fc4

Please sign in to comment.