test: LeaderElection cluster status aggregation
This commit is contained in:
parent
b2d4403f14
commit
3887712d23
1 changed files with 20 additions and 0 deletions
|
|
@ -341,6 +341,26 @@ defmodule Aprsme.Cluster.LeaderElectionTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "get_cluster_aprs_status/0 clustered mode" do
|
||||
setup do
|
||||
original = Application.get_env(:aprsme, :cluster_enabled)
|
||||
on_exit(fn -> Application.put_env(:aprsme, :cluster_enabled, original || false) end)
|
||||
:ok
|
||||
end
|
||||
|
||||
test "clustered mode aggregates local status with cluster_info" do
|
||||
Application.put_env(:aprsme, :cluster_enabled, true)
|
||||
status = LeaderElection.get_cluster_aprs_status()
|
||||
assert is_map(status)
|
||||
# In clustered mode, cluster_info is added.
|
||||
if Map.has_key?(status, :cluster_info) do
|
||||
assert is_map(status.cluster_info)
|
||||
assert Map.has_key?(status.cluster_info, :total_nodes)
|
||||
assert Map.has_key?(status.cluster_info, :connected_nodes)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "handle_info(:check_cluster_and_elect) direct callback" do
|
||||
test "no-ops when election already forced" do
|
||||
state = %LeaderElection{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue