Remove flaky LeaderElection dead-pid cleanup test

This commit is contained in:
Graham McIntire 2026-05-08 17:27:48 -05:00
parent e95e2bfe32
commit 0caf7e4fda
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -354,29 +354,6 @@ defmodule Aprsme.Cluster.LeaderElectionTest do
end
end
test "attempt_election triggers cleanup_stale_registrations for dead-local-process" do
# Spawn a process that exits immediately, then register it globally so
# cleanup_stale_registrations sees a dead pid and cleans it up.
Application.put_env(:aprsme, :cluster_enabled, false)
:global.unregister_name(@election_key)
dead_pid = spawn(fn -> :ok end)
Process.sleep(20)
refute Process.alive?(dead_pid)
try do
:global.register_name(@election_key, dead_pid)
rescue
_ -> :ok
end
state = %LeaderElection{cluster_enabled: false, is_leader: false, leader_node: nil}
assert {:noreply, _new_state} = LeaderElection.handle_info(:attempt_election, state)
# cleanup happens; subsequent calls should still work.
:global.unregister_name(@election_key)
end
test "clustered get_cluster_aprs_status with registered leader pid hits get_leader_node_name pid branch" do
Application.put_env(:aprsme, :cluster_enabled, true)