Skip to content

Commit

Permalink
Add crash test
Browse files Browse the repository at this point in the history
  • Loading branch information
reachfh committed Jul 21, 2024
1 parent cbde2c9 commit e14fd3b
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/logger_formatter_json_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,50 @@ unstructured(_) ->
)
)
),
?assertEqual(
<<
"{\"msg\":\"#PID<0.5054.0> running ExampleWeb.Endpoint (connection #PID<0.5053.0>, stream id 1) terminated\\nServer: app.tezrac.com:80 (http)\\nRequest: GET /dash/listings/44\\n** (exit) an exception was raised:\\n ** (KeyError) key :prod_identifier not found in: %{\\n id: \\\"gid://shopify/ProductVariant/42739636764833\\\",\\n description: \\\"Example\\\"\\n}\\n (example 0.1.0) lib/example_web/controllers/dash_controller.ex:58: anonymous fn/2 in ExampleWeb.DashController.admin_listing_page/2\\n (elixir 1.17.2) lib/enum.ex:4301: Enum.filter_list/2\\n (example 0.1.0) lib/example_web/controllers/dash_controller.ex:58: ExampleWeb.DashController.admin_listing_page/2\\n (example 0.1.0) lib/example_web/controllers/dash_controller.ex:1: ExampleWeb.DashController.action/2\\n (example 0.1.0) lib/example_web/controllers/dash_controller.ex:1: ExampleWeb.DashController.phoenix_controller_pipeline/2\\n (phoenix 1.7.14) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5\\n (example 0.1.0) deps/plug/lib/plug/error_handler.ex:80: ExampleWeb.Router.call/2\\n (example 0.1.0) lib/example_web/endpoint.ex:1: ExampleWeb.Endpoint.plug_builder_call/2\",\"level\":\"info\"}\n"
>>,
iolist_to_binary(
logger_formatter_json:format(
#{
level => info,
msg
=>
{
string,
[
<<"#PID<0.5054.0>">>,
<<" running ">>,
<<"ExampleWeb.Endpoint">>,
[<<" (connection ">>, <<"#PID<0.5053.0>">>, <<", stream id ">>, <<"1">>, 41],
<<" terminated\n">>,
[
[
<<"Server: ">>,
<<"app.tezrac.com">>,
<<":">>,
<<"80">>,
32,
40,
<<"http">>,
41,
10
],
[<<"Request: ">>, <<"GET">>, 32, <<"/dash/listings/44">>, 10]
]
|
<<
"** (exit) an exception was raised:\n ** (KeyError) key :prod_identifier not found in: %{\n id: \"gid://shopify/ProductVariant/42739636764833\",\n description: \"Example\"\n}\n (example 0.1.0) lib/example_web/controllers/dash_controller.ex:58: anonymous fn/2 in ExampleWeb.DashController.admin_listing_page/2\n (elixir 1.17.2) lib/enum.ex:4301: Enum.filter_list/2\n (example 0.1.0) lib/example_web/controllers/dash_controller.ex:58: ExampleWeb.DashController.admin_listing_page/2\n (example 0.1.0) lib/example_web/controllers/dash_controller.ex:1: ExampleWeb.DashController.action/2\n (example 0.1.0) lib/example_web/controllers/dash_controller.ex:1: ExampleWeb.DashController.phoenix_controller_pipeline/2\n (phoenix 1.7.14) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5\n (example 0.1.0) deps/plug/lib/plug/error_handler.ex:80: ExampleWeb.Router.call/2\n (example 0.1.0) lib/example_web/endpoint.ex:1: ExampleWeb.Endpoint.plug_builder_call/2"
>>
]
},
meta => #{}
},
Config
)
)
),
ok.


Expand Down

0 comments on commit e14fd3b

Please sign in to comment.