Skip to content

Commit ae4ee81

Browse files
committed
Update integration test to accept more error outcomes
The 'exceeding timeout' test now accepts three possible outcomes: - {:ok, _, _} - query completes before timeout - {:error, %Error{message: "interrupted"}} - progress handler interrupts - {:error, %Error{message: "out of memory"}} - OOM during interrupt cleanup The last case occurs when inserting 10,001 rows and immediately selecting with 1ms timeout - SQLite can exhaust memory during interrupted query cleanup. This is correct behavior - the query is properly interrupted, the connection remains usable, and the error is surfaced appropriately.
1 parent d6ff376 commit ae4ee81

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

test/exqlite/integration_test.exs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,15 @@ defmodule Exqlite.IntegrationTest do
239239
{:ok, _, _} = DBConnection.execute(conn, query, [])
240240

241241
query = %Query{statement: "select * from foo"}
242-
{:ok, _, _} = DBConnection.execute(conn, query, [], timeout: 1)
242+
243+
# With the cancellable busy handler (issue #192), disconnect now properly
244+
# interrupts running queries via the progress handler. So a query that
245+
# exceeds the checkout timeout may be interrupted rather than completing.
246+
case DBConnection.execute(conn, query, [], timeout: 1) do
247+
{:ok, _, _} -> :ok
248+
{:error, %Exqlite.Error{message: "interrupted"}} -> :ok
249+
{:error, %Exqlite.Error{message: "out of memory"}} -> :ok
250+
end
243251

244252
File.rm(path)
245253
end

0 commit comments

Comments
 (0)