Просмотр исходного кода

test: use valid config for jq function timeout

Zaiming (Stone) Shi 2 лет назад
Родитель
Сommit
f5e9d3eab2
1 измененных файлов с 5 добавлено и 15 удалено
  1. 5 15
      apps/emqx_rule_engine/test/emqx_rule_funcs_SUITE.erl

+ 5 - 15
apps/emqx_rule_engine/test/emqx_rule_funcs_SUITE.erl

@@ -28,7 +28,7 @@
 
 init_per_suite(Config) ->
     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),
     Config.
 
@@ -691,20 +691,10 @@ t_jq(_) ->
         ConfigRootKey,
         jq_function_default_timeout
     ]),
-    case DefaultTimeOut =< 15000 of
-        true ->
-            got_timeout =
-                try
-                    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.
+    ?assertThrow(
+        {jq_exception, {timeout, _}},
+        apply_func(jq, [TOProgram, <<"-2">>])
+    ).
 
 ascii_string() -> list(range(0, 127)).