Skip to content

Commit 04baa4b

Browse files
mjcCopilot
andcommitted
Add CI coverage for cancellation regressions
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4a883c2 commit 04baa4b

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,27 @@ jobs:
8383
- run: mix deps.compile
8484
- run: mix compile
8585
- run: mix test
86+
87+
cancellation-test:
88+
runs-on: ubuntu-latest
89+
env:
90+
MIX_ENV: test
91+
DEBUG: "1"
92+
93+
name: Cancellation regression tests
94+
95+
steps:
96+
- uses: actions/checkout@v6
97+
- uses: erlef/setup-beam@v1
98+
with:
99+
otp-version: "28"
100+
elixir-version: "1.19"
101+
- uses: actions/cache@v5
102+
with:
103+
path: deps
104+
key: ubuntu-latest-otp_28-elixir_1.19-mix_${{ hashFiles('**/mix.lock') }}
105+
restore-keys: ubuntu-latest-otp_28-elixir_1.19-mix_
106+
- run: mix deps.get --only test
107+
- run: mix deps.compile
108+
- run: mix compile
109+
- run: mix test --include slow_test test/exqlite/cancellation_test.exs

test/exqlite/integration_test.exs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,15 @@ defmodule Exqlite.IntegrationTest do
243243
# With the cancellable busy handler (issue #192), disconnect now properly
244244
# interrupts running queries via the progress handler. So a query that
245245
# exceeds the checkout timeout may be interrupted rather than completing.
246-
# With a 1ms timeout the disconnect can race mid-allocation, so SQLite may
247-
# also return SQLITE_NOMEM before the interrupt lands — that's expected here.
248-
case DBConnection.execute(conn, query, [], timeout: 1) do
246+
# Use a small but non-trivial timeout so the disconnect lands during query
247+
# execution without racing SQLite's initial row allocation path.
248+
case DBConnection.execute(conn, query, [], timeout: 10) do
249249
{:ok, _, _} ->
250250
:ok
251251

252252
{:error, %Exqlite.Error{message: "interrupted"}} ->
253253
:ok
254254

255-
{:error, %Exqlite.Error{message: "out of memory"}} ->
256-
:ok
257-
258255
{:error, %Exqlite.Error{message: msg}} ->
259256
flunk("Unexpected error while executing query: #{msg}")
260257
end

0 commit comments

Comments
 (0)