Skip to content

Commit 9112d61

Browse files
add test
1 parent 88783cc commit 9112d61

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/query_test.exs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,4 +1965,17 @@ defmodule QueryTest do
19651965
Postgrex.execute!(context[:pid], "name", "postgrex")
19661966
end
19671967
end
1968+
1969+
test "disconnect_and_retry", context do
1970+
fun = fn conn ->
1971+
{:pool_ref, _, _, _, holder, _} = conn.pool_ref
1972+
[{:conn, _, _ ,state , _, _, _, _}] = :ets.lookup(holder, :conn)
1973+
{:gen_tcp, sock} = state.sock
1974+
sock
1975+
end
1976+
1977+
sock = DBConnection.run(context.pid, fun)
1978+
:gen_tcp.shutdown(sock, :read_write)
1979+
assert (%Postgrex.Query{} = query) = prepare("42", "SELECT 42")
1980+
end
19681981
end

0 commit comments

Comments
 (0)