fix: test case t_write_failure

This commit is contained in:
Dennis Zhuang 2023-12-04 18:04:04 +08:00
parent 547acef01d
commit fbeb56e475
1 changed files with 15 additions and 11 deletions

View File

@ -938,14 +938,15 @@ t_write_failure(Config) ->
emqx_common_test_helpers:with_failure(down, ProxyName, ProxyHost, ProxyPort, fun() -> emqx_common_test_helpers:with_failure(down, ProxyName, ProxyHost, ProxyPort, fun() ->
case QueryMode of case QueryMode of
sync -> sync ->
?wait_async_action( {_, {ok, _}} =
?assertMatch( ?wait_async_action(
{error, {resource_error, #{reason := timeout}}}, ?assertMatch(
send_message(Config, SentData) {error, {resource_error, #{reason := timeout}}},
), send_message(Config, SentData)
#{?snk_kind := greptimedb_connector_do_query_failure, action := nack}, ),
16_000 #{?snk_kind := handle_async_reply, action := nack},
); 1_000
);
async -> async ->
?wait_async_action( ?wait_async_action(
?assertEqual(ok, send_message(Config, SentData)), ?assertEqual(ok, send_message(Config, SentData)),
@ -957,9 +958,12 @@ t_write_failure(Config) ->
fun(Trace0) -> fun(Trace0) ->
case QueryMode of case QueryMode of
sync -> sync ->
?assertMatch( Trace = ?of_kind(handle_async_reply, Trace0),
[#{error := _} | _], ?assertMatch([_ | _], Trace),
?of_kind(greptimedb_connector_do_query_failure, Trace0) [#{result := Result} | _] = Trace,
?assert(
not emqx_bridge_greptimedb_connector:is_unrecoverable_error(Result),
#{got => Result}
); );
async -> async ->
Trace = ?of_kind(handle_async_reply, Trace0), Trace = ?of_kind(handle_async_reply, Trace0),