Skip to content

Commit b6c9f83

Browse files
committed
add test
1 parent 313c337 commit b6c9f83

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/mix/sentry.send_test_event_test.exs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
defmodule Mix.Tasks.Sentry.SendTestEventTest do
22
use ExUnit.Case
33
import ExUnit.CaptureIO
4+
import ExUnit.CaptureLog
45
import Sentry.TestEnvironmentHelper
56

67
test "prints if environment_name is not in included_environments" do
@@ -46,4 +47,24 @@ defmodule Mix.Tasks.Sentry.SendTestEventTest do
4647
Test event sent! Event ID: 340
4748
"""
4849
end
50+
51+
test "handles :error when Sentry server is unreachable" do
52+
modify_env(:sentry, [dsn: "http://public:secret@localhost:0/1"])
53+
capture_log(fn ->
54+
assert capture_io(fn ->
55+
Mix.Tasks.Sentry.SendTestEvent.run([])
56+
end) == """
57+
Client configuration:
58+
server: http://localhost:0/api/1/store/
59+
public_key: public
60+
secret_key: secret
61+
included_environments: [:test]
62+
current environment_name: :test
63+
hackney_opts: [recv_timeout: 50]
64+
65+
Sending test event...
66+
Error sending event!
67+
"""
68+
end)
69+
end
4970
end

0 commit comments

Comments
 (0)