Fix notification skipping

This commit is contained in:
Claudio Ortolina
2026-03-10 08:44:27 +00:00
parent 8347bd04e8
commit 04955bff84
2 changed files with 17 additions and 5 deletions
+15 -3
View File
@@ -124,8 +124,9 @@ defmodule ErrorTracker.ErrorNotifierTest do
# Second notification for same error: throttled
:telemetry.execute([:error_tracker, :occurrence, :new], %{}, %{
error: %ErrorTracker.Error{id: 1},
occurrence: occurrence(%{error_id: 1})
error: %Error{id: 1},
occurrence: occurrence(%{error_id: 1}),
muted: false
})
Process.sleep(50)
@@ -138,13 +139,24 @@ defmodule ErrorTracker.ErrorNotifierTest do
describe "skipping" do
test "skips notification when error is muted" do
Application.put_env(:music_library, ErrorNotifier, @config)
{:ok, pid} = ErrorNotifier.start_link([])
:telemetry.execute([:error_tracker, :error, :new], %{}, %{
error: %Error{id: 1, muted: true},
error: %Error{id: 1},
occurrence: occurrence(%{error_id: 1})
})
Process.sleep(50)
assert_email_sent()
:telemetry.execute([:error_tracker, :occurrence, :new], %{}, %{
error: %Error{id: 2},
occurrence: occurrence(%{error_id: 2}),
muted: true
})
Process.sleep(50)
refute_email_sent()
GenServer.stop(pid)