oban-bg / oban

💎 Robust job processing in Elixir, backed by modern PostgreSQL and SQLite3
https://oban.pro
Apache License 2.0
3.37k stars 314 forks source link

Oban.drain_queue isn't working anymore in test #1070

Closed Kalaww closed 7 months ago

Kalaww commented 7 months ago

Environment

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 https://github.com/sorentwo/oban/issues/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

sorentwo commented 7 months ago

@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.

Kalaww commented 7 months ago

Thank you for the fast answer, works great with Oban.Pro.Testing.drain_jobs/1