test(oracle): attempt to fix flaky test
https://github.com/emqx/emqx/actions/runs/5126014459/jobs/9220155908#step:7:754 ``` =CRITICAL REPORT==== 30-May-2023::20:50:26.267103 === Run stage failed: error:{assertMatch, [{module,emqx_bridge_oracle_SUITE}, {line,394}, {expression, "emqx_resource : simple_sync_query ( ResourceId , { query , \"SELECT COUNT(*) FROM mqtt_test\" } )"}, {pattern, "{ ok , [ { result_set , _ , _ , [ [ { 3 } ] ] } ] }"}, {value, {ok,[{result_set,[<<"COUNT(*)">>],[],[[{0}]]}]}}]} Stacktrace: [{emqx_bridge_oracle_SUITE,'-t_batch_sync_query/1-fun-5-',1, [{file, "/emqx/apps/emqx_bridge_oracle/test/emqx_bridge_oracle_SUITE.erl"}, {line,394}]}, {emqx_bridge_oracle_SUITE,'-t_batch_sync_query/1-fun-6-',5, [{file, "/emqx/apps/emqx_bridge_oracle/test/emqx_bridge_oracle_SUITE.erl"}, {line,390}]}, {emqx_bridge_oracle_SUITE,t_batch_sync_query,1, [{file, "/emqx/apps/emqx_bridge_oracle/test/emqx_bridge_oracle_SUITE.erl"}, {line,364}]}] ```
This commit is contained in:
parent
0d539e91d1
commit
e7b35011e6
|
@ -203,8 +203,9 @@ oracle_config(TestCase, _ConnectionType, Config) ->
|
||||||
" pool_size = 1\n"
|
" pool_size = 1\n"
|
||||||
" sql = \"~s\"\n"
|
" sql = \"~s\"\n"
|
||||||
" resource_opts = {\n"
|
" resource_opts = {\n"
|
||||||
" auto_restart_interval = 5000\n"
|
" auto_restart_interval = \"5s\"\n"
|
||||||
" request_timeout = 30000\n"
|
" health_check_interval = \"5s\"\n"
|
||||||
|
" request_timeout = \"30s\"\n"
|
||||||
" query_mode = \"async\"\n"
|
" query_mode = \"async\"\n"
|
||||||
" enable_batch = true\n"
|
" enable_batch = true\n"
|
||||||
" batch_size = 3\n"
|
" batch_size = 3\n"
|
||||||
|
@ -233,6 +234,11 @@ resource_id(Config) ->
|
||||||
Name = ?config(oracle_name, Config),
|
Name = ?config(oracle_name, Config),
|
||||||
emqx_bridge_resource:resource_id(Type, Name).
|
emqx_bridge_resource:resource_id(Type, Name).
|
||||||
|
|
||||||
|
bridge_id(Config) ->
|
||||||
|
Type = ?BRIDGE_TYPE_BIN,
|
||||||
|
Name = ?config(oracle_name, Config),
|
||||||
|
emqx_bridge_resource:bridge_id(Type, Name).
|
||||||
|
|
||||||
create_bridge(Config) ->
|
create_bridge(Config) ->
|
||||||
create_bridge(Config, _Overrides = #{}).
|
create_bridge(Config, _Overrides = #{}).
|
||||||
|
|
||||||
|
@ -361,6 +367,7 @@ t_batch_sync_query(Config) ->
|
||||||
ProxyHost = ?config(proxy_host, Config),
|
ProxyHost = ?config(proxy_host, Config),
|
||||||
ProxyName = ?config(proxy_name, Config),
|
ProxyName = ?config(proxy_name, Config),
|
||||||
ResourceId = resource_id(Config),
|
ResourceId = resource_id(Config),
|
||||||
|
BridgeId = bridge_id(Config),
|
||||||
?check_trace(
|
?check_trace(
|
||||||
begin
|
begin
|
||||||
?assertMatch({ok, _}, create_bridge_api(Config)),
|
?assertMatch({ok, _}, create_bridge_api(Config)),
|
||||||
|
@ -380,12 +387,12 @@ t_batch_sync_query(Config) ->
|
||||||
% Send 3 async messages while resource is down. When it comes back, these messages
|
% Send 3 async messages while resource is down. When it comes back, these messages
|
||||||
% will be delivered in sync way. If we try to send sync messages directly, it will
|
% will be delivered in sync way. If we try to send sync messages directly, it will
|
||||||
% be sent async as callback_mode is set to async_if_possible.
|
% be sent async as callback_mode is set to async_if_possible.
|
||||||
Message = {send_message, Params},
|
|
||||||
emqx_common_test_helpers:with_failure(down, ProxyName, ProxyHost, ProxyPort, fun() ->
|
emqx_common_test_helpers:with_failure(down, ProxyName, ProxyHost, ProxyPort, fun() ->
|
||||||
ct:sleep(1000),
|
ct:sleep(1000),
|
||||||
emqx_resource:query(ResourceId, Message),
|
emqx_bridge:send_message(BridgeId, Params),
|
||||||
emqx_resource:query(ResourceId, Message),
|
emqx_bridge:send_message(BridgeId, Params),
|
||||||
emqx_resource:query(ResourceId, Message)
|
emqx_bridge:send_message(BridgeId, Params),
|
||||||
|
ok
|
||||||
end),
|
end),
|
||||||
?retry(
|
?retry(
|
||||||
_Sleep = 1_000,
|
_Sleep = 1_000,
|
||||||
|
|
Loading…
Reference in New Issue