Test helpers don't work with SQLite3 unless prefix: false is explicitely used
Closed this issue · 1 comments
martosaur commented
Environment
- current main
44c24764a66fd58b5ac3c71b2cd6e679a8795313
- SQLite3
- Elixir 1.15.7
Current Behavior
Consider this test in manual mode:
defmodule MyApp.WorkerTest do
use ExUnit.Case, async: false
use Oban.Testing, repo: MyApp.Repo
test "inserts another job if there is next page" do
all_enqueued()
end
end
it raises
** (ArgumentError) SQLite3 does not support table prefixes
code: all_enqueued()
stacktrace:
(ecto_sqlite3 0.12.0) lib/ecto/adapters/sqlite3/connection.ex:1874: Ecto.Adapters.SQLite3.Connection.quote_table/2
(ecto_sqlite3 0.12.0) lib/ecto/adapters/sqlite3/connection.ex:1554: Ecto.Adapters.SQLite3.Connection.create_name/3
(ecto_sqlite3 0.12.0) lib/ecto/adapters/sqlite3/connection.ex:1534: Ecto.Adapters.SQLite3.Connection.create_names/4
(ecto_sqlite3 0.12.0) lib/ecto/adapters/sqlite3/connection.ex:1529: Ecto.Adapters.SQLite3.Connection.create_names/2
(ecto_sqlite3 0.12.0) lib/ecto/adapters/sqlite3/connection.ex:174: Ecto.Adapters.SQLite3.Connection.all/2
(ecto_sqlite3 0.12.0) lib/ecto/adapters/sqlite3.ex:176: Ecto.Adapters.SQLite3.prepare/2
(ecto 3.11.0) lib/ecto/query/planner.ex:182: Ecto.Query.Planner.query_without_cache/4
(ecto 3.11.0) lib/ecto/query/planner.ex:152: Ecto.Query.Planner.query_prepare/6
(ecto 3.11.0) lib/ecto/query/planner.ex:127: Ecto.Query.Planner.query_with_cache/8
(ecto 3.11.0) lib/ecto/repo/queryable.ex:214: Ecto.Repo.Queryable.execute/4
(ecto 3.11.0) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
(oban 2.16.3) lib/oban/testing.ex:633: Oban.Testing.filter_jobs/2
The workaround is to explicitly add prefix: false
to use
statement. I believe the reason for the exception is that we build new config here, which receives only explicit config options and thus uses default engine and consequentially prefix.
Expected Behavior
Test helpers shouldn't raise
sorentwo commented
Thanks for the report!