Skip to content

Commit b819265

Browse files
committed
Add a test for statement_timeout=
1 parent 3ebee19 commit b819265

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/test_integration_statement.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,20 @@ def test_committing_tx_with_statement_active
191191
end
192192
assert called
193193
end
194+
195+
def test_long_running_statements_get_interrupted_when_statement_timeout_set
196+
@db.statement_timeout = 100
197+
assert_raises(SQLite3::InterruptException) do
198+
@db.execute <<~SQL
199+
WITH RECURSIVE r(i) AS (
200+
VALUES(0)
201+
UNION ALL
202+
SELECT i FROM r
203+
LIMIT 10000000
204+
)
205+
SELECT i FROM r ORDER BY i LIMIT 1;
206+
SQL
207+
end
208+
@db.statement_timeout = nil
209+
end
194210
end

0 commit comments

Comments
 (0)