|
|
@@ -911,69 +911,6 @@ t_start_exception(Config) ->
|
|
|
),
|
|
|
ok.
|
|
|
|
|
|
-t_write_failure(Config) ->
|
|
|
- ProxyName = ?config(proxy_name, Config),
|
|
|
- ProxyPort = ?config(proxy_port, Config),
|
|
|
- ProxyHost = ?config(proxy_host, Config),
|
|
|
- QueryMode = ?config(query_mode, Config),
|
|
|
- {ok, _} = create_bridge(Config),
|
|
|
- ClientId = emqx_guid:to_hexstr(emqx_guid:gen()),
|
|
|
- Payload = #{
|
|
|
- int_key => -123,
|
|
|
- bool => true,
|
|
|
- float_key => 24.5,
|
|
|
- uint_key => 123
|
|
|
- },
|
|
|
- SentData = #{
|
|
|
- <<"clientid">> => ClientId,
|
|
|
- <<"topic">> => atom_to_binary(?FUNCTION_NAME),
|
|
|
- <<"timestamp">> => erlang:system_time(millisecond),
|
|
|
- <<"payload">> => Payload
|
|
|
- },
|
|
|
- ?check_trace(
|
|
|
- emqx_common_test_helpers:with_failure(down, ProxyName, ProxyHost, ProxyPort, fun() ->
|
|
|
- case QueryMode of
|
|
|
- sync ->
|
|
|
- ?wait_async_action(
|
|
|
- ?assertMatch(
|
|
|
- {error, {resource_error, #{reason := timeout}}},
|
|
|
- send_message(Config, SentData)
|
|
|
- ),
|
|
|
- #{?snk_kind := handle_async_reply, action := nack},
|
|
|
- 1_000
|
|
|
- );
|
|
|
- async ->
|
|
|
- ?wait_async_action(
|
|
|
- ?assertEqual(ok, send_message(Config, SentData)),
|
|
|
- #{?snk_kind := handle_async_reply},
|
|
|
- 1_000
|
|
|
- )
|
|
|
- end
|
|
|
- end),
|
|
|
- fun(Trace0) ->
|
|
|
- case QueryMode of
|
|
|
- sync ->
|
|
|
- Trace = ?of_kind(handle_async_reply, Trace0),
|
|
|
- ?assertMatch([_ | _], Trace),
|
|
|
- [#{result := Result} | _] = Trace,
|
|
|
- ?assert(
|
|
|
- not emqx_bridge_greptimedb_connector:is_unrecoverable_error(Result),
|
|
|
- #{got => Result}
|
|
|
- );
|
|
|
- async ->
|
|
|
- Trace = ?of_kind(handle_async_reply, Trace0),
|
|
|
- ?assertMatch([_ | _], Trace),
|
|
|
- [#{result := Result} | _] = Trace,
|
|
|
- ?assert(
|
|
|
- not emqx_bridge_greptimedb_connector:is_unrecoverable_error(Result),
|
|
|
- #{got => Result}
|
|
|
- )
|
|
|
- end,
|
|
|
- ok
|
|
|
- end
|
|
|
- ),
|
|
|
- ok.
|
|
|
-
|
|
|
t_missing_field(Config) ->
|
|
|
BatchSize = ?config(batch_size, Config),
|
|
|
IsBatch = BatchSize > 1,
|