Fix notification skipping
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user