Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions integration_test/cases/after_connect_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,18 @@ defmodule AfterConnectTest do

assert_receive {:after_connect, after_pid}

prefix =
"client #{inspect(after_pid)} stopped: " <>
"** (DBConnection.ConnectionError) bad return value: :oops"

len = byte_size(prefix)
pid_str = inspect(after_pid)

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(DBConnection\.ConnectionError\) bad return value: :oops/,
message
)

assert [
{:connect, _},
{:handle_status, _},
Expand Down Expand Up @@ -266,14 +267,18 @@ defmodule AfterConnectTest do
assert_receive {:hi, conn}

assert_receive {:after_connect, after_pid}
prefix = "client #{inspect(after_pid)} stopped: ** (RuntimeError) oops"
len = byte_size(prefix)
pid_str = inspect(after_pid)

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(RuntimeError\) oops/,
message
)

assert [
{:connect, _},
{:handle_status, _},
Expand Down
23 changes: 14 additions & 9 deletions integration_test/cases/execute_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -432,17 +432,18 @@ defmodule ExecuteTest do
P.execute(pool, %Q{}, [:param])
end

prefix =
"client #{inspect(self())} stopped: " <>
"** (DBConnection.ConnectionError) bad return value: :oops"

len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(DBConnection\.ConnectionError\) bad return value: :oops/,
message
)

assert [
{:connect, _},
{:handle_execute, [%Q{}, [:param], _, :state]},
Expand Down Expand Up @@ -473,14 +474,18 @@ defmodule ExecuteTest do
Process.flag(:trap_exit, true)
assert_raise RuntimeError, "oops", fn -> P.execute(pool, %Q{}, [:param]) end

prefix = "client #{inspect(self())} stopped: ** (RuntimeError) oops"
len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(RuntimeError\) oops/,
message
)

assert [
{:connect, _},
{:handle_execute, [%Q{}, [:param], _, :state]},
Expand Down
23 changes: 14 additions & 9 deletions integration_test/cases/prepare_stream_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,18 @@ defmodule PrepareStreamTest do
:hi
end) == {:error, :rollback}

prefix =
"client #{inspect(self())} stopped: " <>
"** (DBConnection.ConnectionError) bad return value: :oops"

len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(DBConnection\.ConnectionError\) bad return value: :oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down Expand Up @@ -336,14 +337,18 @@ defmodule PrepareStreamTest do
:hi
end) == {:error, :rollback}

prefix = "client #{inspect(self())} stopped: ** (RuntimeError) oops"
len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(RuntimeError\) oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down
46 changes: 28 additions & 18 deletions integration_test/cases/stream_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -432,17 +432,18 @@ defmodule StreamTest do
:hi
end) == {:error, :rollback}

prefix =
"client #{inspect(self())} stopped: " <>
"** (DBConnection.ConnectionError) bad return value: :oops"

len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(DBConnection\.ConnectionError\) bad return value: :oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down Expand Up @@ -481,14 +482,18 @@ defmodule StreamTest do
:hi
end) == {:error, :rollback}

prefix = "client #{inspect(self())} stopped: ** (RuntimeError) oops"
len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(RuntimeError\) oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down Expand Up @@ -567,17 +572,18 @@ defmodule StreamTest do
:hi
end) == {:error, :rollback}

prefix =
"client #{inspect(self())} stopped: " <>
"** (DBConnection.ConnectionError) bad return value: :oops"

len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(DBConnection\.ConnectionError\) bad return value: :oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down Expand Up @@ -619,14 +625,18 @@ defmodule StreamTest do
:hi
end) == {:error, :rollback}

prefix = "client #{inspect(self())} stopped: ** (RuntimeError) oops"
len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(RuntimeError\) oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down
23 changes: 14 additions & 9 deletions integration_test/cases/transaction_execute_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,18 @@ defmodule TransactionExecuteTest do
:closed
end) == {:error, :rollback}

prefix =
"client #{inspect(self())} stopped: " <>
"** (DBConnection.ConnectionError) bad return value: :oops"

len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(DBConnection\.ConnectionError\) bad return value: :oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down Expand Up @@ -267,14 +268,18 @@ defmodule TransactionExecuteTest do
:closed
end) == {:error, :rollback}

prefix = "client #{inspect(self())} stopped: ** (RuntimeError) oops"
len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(RuntimeError\) oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down
46 changes: 28 additions & 18 deletions integration_test/cases/transaction_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -523,17 +523,18 @@ defmodule TransactionTest do
P.transaction(pool, fn _ -> flunk("transaction ran") end)
end

prefix =
"client #{inspect(self())} stopped: " <>
"** (DBConnection.ConnectionError) bad return value: :oops"

len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(DBConnection\.ConnectionError\) bad return value: :oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down Expand Up @@ -567,14 +568,18 @@ defmodule TransactionTest do
P.transaction(pool, fn _ -> flunk("transaction ran") end)
end

prefix = "client #{inspect(self())} stopped: ** (RuntimeError) oops"
len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(RuntimeError\) oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down Expand Up @@ -709,17 +714,18 @@ defmodule TransactionTest do
P.transaction(pool, fn _ -> :result end)
end

prefix =
"client #{inspect(self())} stopped: " <>
"** (DBConnection.ConnectionError) bad return value: :oops"

len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(DBConnection\.ConnectionError\) bad return value: :oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down Expand Up @@ -752,14 +758,18 @@ defmodule TransactionTest do
Process.flag(:trap_exit, true)
assert_raise RuntimeError, "oops", fn -> P.transaction(pool, fn _ -> :result end) end

prefix = "client #{inspect(self())} stopped: ** (RuntimeError) oops"
len = byte_size(prefix)
pid_str = inspect(self())

assert_receive {:EXIT, ^conn,
{%DBConnection.ConnectionError{
message: <<^prefix::binary-size(len), _::binary>>
message: message
}, [_ | _]}}

assert Regex.match?(
~r/^client #{Regex.escape(pid_str)}(?<optional_pid_info>\s*\([^)]+\))?\s+stopped: \*\* \(RuntimeError\) oops/,
message
)

assert [
{:connect, _},
{:handle_begin, [_, :state]},
Expand Down
Loading