chore(ocsp): catch unexpected error when fetching ocsp response
This commit is contained in:
parent
d1f58d6e2d
commit
a614bdc94a
|
@ -300,7 +300,17 @@ with_refresh_params(ListenerID, Conf, ErrorRet, Fn) ->
|
|||
error ->
|
||||
ErrorRet;
|
||||
{ok, Params} ->
|
||||
Fn(Params)
|
||||
try
|
||||
Fn(Params)
|
||||
catch
|
||||
Kind:Error ->
|
||||
?SLOG(error, #{
|
||||
msg => "error_fetching_ocsp_response",
|
||||
listener_id => ListenerID,
|
||||
error => {Kind, Error}
|
||||
}),
|
||||
ErrorRet
|
||||
end
|
||||
end.
|
||||
|
||||
get_refresh_params(ListenerID, undefined = _Conf) ->
|
||||
|
|
|
@ -912,6 +912,24 @@ do_t_validations(_Config) ->
|
|||
|
||||
ok.
|
||||
|
||||
t_unknown_error_fetching_ocsp_response(_Config) ->
|
||||
ListenerID = <<"ssl:test_ocsp">>,
|
||||
TestPid = self(),
|
||||
ok = meck:expect(
|
||||
emqx_ocsp_cache,
|
||||
http_get,
|
||||
fun(_RequestURI, _HTTPTimeout) ->
|
||||
TestPid ! error_raised,
|
||||
meck:exception(error, something_went_wrong)
|
||||
end
|
||||
),
|
||||
?assertEqual(error, emqx_ocsp_cache:fetch_response(ListenerID)),
|
||||
receive
|
||||
error_raised -> ok
|
||||
after 200 -> ct:fail("should have tried to fetch ocsp response")
|
||||
end,
|
||||
ok.
|
||||
|
||||
t_openssl_client(Config) ->
|
||||
TLSVsn = ?config(tls_vsn, Config),
|
||||
WithStatusRequest = ?config(status_request, Config),
|
||||
|
|
Loading…
Reference in New Issue