Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 685256f

Browse files
MichaelBakerConnorRigby
authored andcommitted
Adds a test for timeout behavior
1 parent 7345e3f commit 685256f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: test/statement_test.exs

+20
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,24 @@ defmodule StatementTest do
7474
result = Sqlitex.Statement.fetch_all(stmt, 1_000, :raw_list)
7575
assert result == {:error, {:constraint, 'UNIQUE constraint failed: x.str'}}
7676
end
77+
78+
test "custom query timeouts are passed through to esqlite" do
79+
{:ok, db} = Sqlitex.open(":memory:")
80+
81+
{:error, reason, _} = catch_throw(
82+
db
83+
|> Sqlitex.Statement.prepare!("""
84+
WITH RECURSIVE r(i) AS (
85+
VALUES(0)
86+
UNION ALL
87+
SELECT i FROM r
88+
LIMIT 1000000
89+
)
90+
SELECT i FROM r WHERE i = 1
91+
""")
92+
|> Sqlitex.Statement.fetch_all!(1)
93+
)
94+
95+
assert reason == :timeout
96+
end
7797
end

0 commit comments

Comments
 (0)