oban-bg/oban

Bug in assert_enqueued/1 and refute_enqueued/1 when jobs have lists in their args

Closed this issue · 1 comments

Precheck

Environment

  • Oban Version: main (4904a8b)
  • PostgreSQL Version: 14.1
  • Elixir Version: Elixir 1.15.0
  • Erlang/OTP 25

Current Behavior

Adding the following test to test/oban/testing_test.exs fails even though one would expect it succeed:

test "checking for jobs with lists in their args" do
  insert!(%{a: [1]}, worker: Ping, queue: :alpha)
  refute_enqueued args: %{a: [1, 1]}, queue: :alpha
end

Similarly, one would this expect this test to fail, but it succeeds:

test "checking for jobs with lists in their args" do
  insert!(%{a: [1]}, worker: Ping, queue: :alpha)
  assert_enqueued args: %{a: [1, 1]}, queue: :alpha
end

That’s an unexpected consequence of using the containment operator for matching. I think the best option is to move args and meta matching out of the db and into elixir next.