Skip to content

Commit

Permalink
chore: fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwalker committed Sep 17, 2024
1 parent 0d88830 commit da2a8bb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
20 changes: 10 additions & 10 deletions test/strategy_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ defmodule Cluster.StrategyTest do
assert_receive {:connect, :"[email protected]"}

assert_receive {:telemetry_event,
{[:libcluster, :connect_node, :ok], %{duration: _},
%{node: :"[email protected]", topology: _}, _}}
{[:libcluster, :connect_node, :ok], %{duration: _},
%{node: :"[email protected]", topology: _}, _}}
end

test "handles connect failure" do
Expand All @@ -53,8 +53,8 @@ defmodule Cluster.StrategyTest do
assert_receive {:connect, :"[email protected]"}

assert_receive {:telemetry_event,
{[:libcluster, :connect_node, :error], %{},
%{node: :"[email protected]", topology: _, reason: :unreachable}, _}}
{[:libcluster, :connect_node, :error], %{},
%{node: :"[email protected]", topology: _, reason: :unreachable}, _}}
end

test "handles connect ignore" do
Expand All @@ -71,8 +71,8 @@ defmodule Cluster.StrategyTest do
assert_receive {:connect, :"[email protected]"}

assert_receive {:telemetry_event,
{[:libcluster, :connect_node, :error], %{},
%{node: :"[email protected]", topology: _, reason: :not_part_of_network,}, _}}
{[:libcluster, :connect_node, :error], %{},
%{node: :"[email protected]", topology: _, reason: :not_part_of_network}, _}}
end
end

Expand Down Expand Up @@ -102,8 +102,8 @@ defmodule Cluster.StrategyTest do
assert_receive {:disconnect, :"[email protected]"}

assert_receive {:telemetry_event,
{[:libcluster, :disconnect_node, :ok], %{duration: _},
%{node: :"[email protected]", topology: _}, _}}
{[:libcluster, :disconnect_node, :ok], %{duration: _},
%{node: :"[email protected]", topology: _}, _}}
end

test "handles disconnect error" do
Expand All @@ -123,8 +123,8 @@ defmodule Cluster.StrategyTest do
assert_receive {:disconnect, :"[email protected]"}

assert_receive {:telemetry_event,
{[:libcluster, :disconnect_node, :error], %{},
%{node: :"[email protected]", topology: _, reason: ":failed"}, _}}
{[:libcluster, :disconnect_node, :error], %{},
%{node: :"[email protected]", topology: _, reason: ":failed"}, _}}
end
end
end
17 changes: 9 additions & 8 deletions test/support/telemetry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ defmodule Cluster.Telemetry do
def setup_telemetry(event) do
telemetry_handle_id = "test-telemetry-handler-#{inspect(self())}"

:ok = :telemetry.attach_many(
telemetry_handle_id,
[
event,
],
&send_to_pid/4,
nil
)
:ok =
:telemetry.attach_many(
telemetry_handle_id,
[
event
],
&send_to_pid/4,
nil
)

:ok = on_exit(fn -> :telemetry.detach(telemetry_handle_id) end)
end
Expand Down

0 comments on commit da2a8bb

Please sign in to comment.