test: use valid config for jq function timeout

This commit is contained in:
Zaiming (Stone) Shi 2023-03-28 14:28:49 +02:00
parent 3f9ed08308
commit f5e9d3eab2
1 changed files with 5 additions and 15 deletions

View File

@ -28,7 +28,7 @@
init_per_suite(Config) -> init_per_suite(Config) ->
application:load(emqx_conf), application:load(emqx_conf),
ConfigConf = <<"rule_engine {jq_function_default_timeout {}}">>, ConfigConf = <<"rule_engine {jq_function_default_timeout=10s}">>,
ok = emqx_common_test_helpers:load_config(emqx_rule_engine_schema, ConfigConf), ok = emqx_common_test_helpers:load_config(emqx_rule_engine_schema, ConfigConf),
Config. Config.
@ -691,20 +691,10 @@ t_jq(_) ->
ConfigRootKey, ConfigRootKey,
jq_function_default_timeout jq_function_default_timeout
]), ]),
case DefaultTimeOut =< 15000 of ?assertThrow(
true -> {jq_exception, {timeout, _}},
got_timeout =
try
apply_func(jq, [TOProgram, <<"-2">>]) apply_func(jq, [TOProgram, <<"-2">>])
catch ).
throw:{jq_exception, {timeout, _}} ->
%% Got timeout as expected
got_timeout
end;
false ->
%% Skip test as we don't want it to take to long time to run
ok
end.
ascii_string() -> list(range(0, 127)). ascii_string() -> list(range(0, 127)).