Oban.drain_queue isn't working anymore in test
Kalaww opened this issue · 2 comments
Environment
- Oban Version 2.17.8
- Oban Pro Version 1.4.3
- PostgreSQL Version 15
- Elixir 1.16.2 Erlang/OTP 26
Current Behavior
Hello, I have upgraded my oban and oban-pro versions but with the upgrade my tests are failing with this error
** (exit) exited in: GenServer.call({:via, Registry, {Oban.Registry, {Oban, {:producer, "myqueue"}}}}, {:put_meta, :flush, true}, 5000)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
Oban from 2.17.6 to 2.17.8
Oban Pro from 1.3.5 to 1.4.3
This error is happening when I am using manual mode and I try to drain a queue
Oban.Testing.with_testing_mode(:manual, fn ->
enqueue_a_job()
Oban.drain_queue(queue: "myqueue")
end)
I looked at this issue with a similar error but it didn't help me #1055
Expected Behavior
I would like my test to pass or to understand what I need to change for them to pass
Thank you for reading
@Kalaww This is from an incompatibility (bug) in the latest Pro version. It's fixed in Oban on main, but you're encouraged to use [drain_jobs/1](https://oban.pro/docs/pro/1.4.3/Oban.Pro.Testing.html#drain_jobs/1)
from Pro's Testing module instead because it's designed to work with Pro features.
Thank you for the fast answer, works great with Oban.Pro.Testing.drain_jobs/1