File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 11defmodule 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
4970end
You can’t perform that action at this time.
0 commit comments