Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix flaky test when leader peer terminates #981

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test/oban/peers/global_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ defmodule Oban.Peers.GlobalTest do
peer_1 = start_supervised!({Peer, name: A, conf: %{conf | name: Oban, node: "web.1"}})
peer_2 = start_supervised!({Peer, name: B, conf: %{conf | name: Oban, node: "web.2"}})

assert leader = Enum.find([peer_1, peer_2], &Global.leader?/1)
assert :ok = GenServer.stop(leader)
{leader, name} =
Enum.find([{peer_1, A}, {peer_2, B}], fn {pid, _name} ->
Global.leader?(pid)
end)

stop_supervised!(name)

assert_receive {:notification, :leader, %{"down" => _}}

Expand Down
Loading