test: call ct helpers to load config
This commit is contained in:
parent
2a01c7a077
commit
2105d1f22b
|
@ -96,7 +96,7 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
ok = emqx_config:init_load(emqx_limiter_schema, ?BASE_CONF),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_limiter_schema, ?BASE_CONF),
|
||||
emqx_common_test_helpers:start_apps([?APP]),
|
||||
Config.
|
||||
|
||||
|
@ -107,7 +107,7 @@ init_per_testcase(_TestCase, Config) ->
|
|||
Config.
|
||||
|
||||
base_conf() ->
|
||||
emqx_config:init_load(emqx_limiter_schema, ?BASE_CONF).
|
||||
emqx_common_test_helpers:load_config(emqx_limiter_schema, ?BASE_CONF).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Test Cases Bucket Level
|
||||
|
|
|
@ -58,7 +58,7 @@ init_per_suite(Config) ->
|
|||
|
||||
application:load(emqx_dashboard),
|
||||
application:load(?APP),
|
||||
ok = emqx_config:init_load(emqx_auto_subscribe_schema,
|
||||
ok = emqx_common_test_helpers:load_config(emqx_auto_subscribe_schema,
|
||||
<<"auto_subscribe {
|
||||
topics = [
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ init_per_suite(Config) ->
|
|||
_ = application:stop(emqx_resource),
|
||||
_ = application:stop(emqx_connector),
|
||||
ok = emqx_common_test_helpers:start_apps([emqx_bridge, emqx_dashboard]),
|
||||
ok = emqx_config:init_load(emqx_bridge_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_bridge_schema, ?CONF_DEFAULT),
|
||||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
|
|
|
@ -97,9 +97,9 @@ init_per_suite(Config) ->
|
|||
_ = application:stop(emqx_connector),
|
||||
ok = emqx_common_test_helpers:start_apps([emqx_rule_engine, emqx_connector,
|
||||
emqx_bridge, emqx_dashboard]),
|
||||
ok = emqx_config:init_load(emqx_connector_schema, <<"connectors: {}">>),
|
||||
ok = emqx_config:init_load(emqx_rule_engine_schema, <<"rule_engine {rules {}}">>),
|
||||
ok = emqx_config:init_load(emqx_bridge_schema, ?BRIDGE_CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_connector_schema, <<"connectors: {}">>),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_rule_engine_schema, <<"rule_engine {rules {}}">>),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_bridge_schema, ?BRIDGE_CONF_DEFAULT),
|
||||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
|
|
|
@ -53,7 +53,7 @@ gateway.coap
|
|||
all() -> emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
ok = emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_mgmt_api_test_util:init_suite([emqx_gateway]),
|
||||
Config.
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
ok = emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_mgmt_api_test_util:init_suite([emqx_gateway]),
|
||||
Config.
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
|
||||
init_per_suite(Conf) ->
|
||||
emqx_config:erase(gateway),
|
||||
emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:start_apps([emqx_gateway]),
|
||||
Conf.
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
|
||||
init_per_suite(Conf) ->
|
||||
emqx_config:erase(gateway),
|
||||
emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_authn, emqx_gateway]),
|
||||
Conf.
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
|
||||
init_per_suite(Conf) ->
|
||||
emqx_config:erase(gateway),
|
||||
emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_authn, emqx_gateway]),
|
||||
Conf.
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
|
||||
init_per_suite(Conf) ->
|
||||
emqx_config:erase(gateway),
|
||||
emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:start_apps([]),
|
||||
|
||||
ok = meck:new(emqx_gateway_metrics, [passthrough, no_history, no_link]),
|
||||
|
|
|
@ -34,7 +34,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
|
||||
init_per_suite(Conf) ->
|
||||
emqx_config:erase(gateway),
|
||||
emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:start_apps([]),
|
||||
Conf.
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Conf) ->
|
||||
emqx_config:init_load(emqx_gateway_schema, <<"gateway {}">>),
|
||||
emqx_common_test_helpers:load_config(emqx_gateway_schema, <<"gateway {}">>),
|
||||
emqx_common_test_helpers:start_apps([emqx_conf, emqx_authn, emqx_gateway]),
|
||||
Conf.
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
|
||||
init_per_suite(Conf) ->
|
||||
emqx_config:erase(gateway),
|
||||
emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:start_apps([]),
|
||||
Conf.
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
%%--------------------------------------------------------------------
|
||||
|
||||
init_per_suite(Cfg) ->
|
||||
ok = emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:start_apps([emqx_gateway]),
|
||||
Cfg.
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ end_per_suite(Config) ->
|
|||
Config.
|
||||
|
||||
init_per_testcase(_AllTestCase, Config) ->
|
||||
ok = emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
|
||||
{ok, _} = application:ensure_all_started(emqx_gateway),
|
||||
{ok, ClientUdpSock} = gen_udp:open(0, [binary, {active, false}]),
|
||||
|
|
|
@ -69,7 +69,7 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
ok = emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
application:load(emqx_gateway),
|
||||
emqx_mgmt_api_test_util:init_suite([emqx_conf]),
|
||||
Config.
|
||||
|
@ -81,7 +81,7 @@ end_per_suite(Config) ->
|
|||
Config.
|
||||
|
||||
init_per_testcase(_AllTestCase, Config) ->
|
||||
ok = emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
{ok, _} = application:ensure_all_started(emqx_gateway),
|
||||
{ok, ClientUdpSock} = gen_udp:open(0, [binary, {active, false}]),
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
ok = emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_mgmt_api_test_util:init_suite([emqx_gateway]),
|
||||
Config.
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
%%--------------------------------------------------------------------
|
||||
|
||||
init_per_suite(Cfg) ->
|
||||
ok = emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_mgmt_api_test_util:init_suite([emqx_gateway]),
|
||||
Cfg.
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
init_per_suite(Config) ->
|
||||
emqx_common_test_helpers:boot_modules(all),
|
||||
emqx_common_test_helpers:start_apps([emqx_modules]),
|
||||
ok = emqx_config:init_load(emqx_modules_schema, ?EVENT_MESSAGE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?EVENT_MESSAGE),
|
||||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
|
|
|
@ -29,7 +29,7 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Conf) ->
|
||||
emqx_config:init_load(emqx_modules_schema, <<"gateway {}">>),
|
||||
emqx_common_test_helpers:load_config(emqx_modules_schema, <<"gateway {}">>),
|
||||
emqx_common_test_helpers:start_apps([emqx_conf, emqx_modules]),
|
||||
Conf.
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ t_rewrite_re_error(_Config) ->
|
|||
ok.
|
||||
|
||||
t_list(_Config) ->
|
||||
ok = emqx_config:init_load(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?REWRITE),
|
||||
Expect = [
|
||||
#{<<"action">> => <<"publish">>,
|
||||
<<"dest_topic">> => <<"z/y/$1">>,
|
||||
|
@ -130,7 +130,7 @@ t_list(_Config) ->
|
|||
ok.
|
||||
|
||||
t_update(_Config) ->
|
||||
ok = emqx_config:init_load(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?REWRITE),
|
||||
Init = emqx_rewrite:list(),
|
||||
Rules = [#{
|
||||
<<"source_topic">> => <<"test/#">>,
|
||||
|
@ -144,7 +144,7 @@ t_update(_Config) ->
|
|||
ok.
|
||||
|
||||
t_update_disable(_Config) ->
|
||||
ok = emqx_config:init_load(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?REWRITE),
|
||||
?assertEqual(ok, emqx_rewrite:update([])),
|
||||
timer:sleep(150),
|
||||
|
||||
|
@ -159,7 +159,7 @@ t_update_disable(_Config) ->
|
|||
ok.
|
||||
|
||||
t_update_re_failed(_Config) ->
|
||||
ok = emqx_config:init_load(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?REWRITE),
|
||||
Rules = [#{
|
||||
<<"source_topic">> => <<"test/#">>,
|
||||
<<"re">> => <<"*^test/*">>,
|
||||
|
@ -188,7 +188,7 @@ receive_publish(Timeout) ->
|
|||
end.
|
||||
|
||||
init() ->
|
||||
ok = emqx_config:init_load(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_rewrite:enable(),
|
||||
{ok, C} = emqtt:start_link([{clientid, <<"rewrite_client">>}]),
|
||||
{ok, _} = emqtt:connect(C),
|
||||
|
|
|
@ -30,7 +30,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
init_per_suite(Config) ->
|
||||
emqx_common_test_helpers:boot_modules(all),
|
||||
emqx_common_test_helpers:start_apps([emqx_modules]),
|
||||
ok = emqx_config:init_load(emqx_modules_schema, ?TOPIC),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?TOPIC),
|
||||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
|
|
|
@ -57,7 +57,7 @@ init_per_suite(Config) ->
|
|||
meck:expect(emqx_alarm, activate, 3, ok),
|
||||
meck:expect(emqx_alarm, deactivate, 3, ok),
|
||||
|
||||
ok = emqx_config:init_load(emqx_retainer_schema, ?BASE_CONF),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_retainer_schema, ?BASE_CONF),
|
||||
emqx_common_test_helpers:start_apps([emqx_retainer]),
|
||||
Config.
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ all() ->
|
|||
|
||||
init_per_suite(Config) ->
|
||||
application:load(emqx_conf),
|
||||
ok = emqx_config:init_load(emqx_rule_engine_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_rule_engine_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:start_apps([emqx_conf, emqx_rule_engine]),
|
||||
Config.
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
ok = emqx_config:init_load(emqx_slow_subs_schema, ?BASE_CONF),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_slow_subs_schema, ?BASE_CONF),
|
||||
emqx_common_test_helpers:start_apps([emqx_slow_subs]),
|
||||
Config.
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ init_per_suite(Config) ->
|
|||
meck:expect(emqx_alarm, activate, 3, ok),
|
||||
meck:expect(emqx_alarm, deactivate, 3, ok),
|
||||
|
||||
ok = emqx_config:init_load(emqx_slow_subs_schema, ?CONF_DEFAULT),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_slow_subs_schema, ?CONF_DEFAULT),
|
||||
emqx_mgmt_api_test_util:init_suite([emqx_slow_subs]),
|
||||
{ok, _} = application:ensure_all_started(emqx_authn),
|
||||
Config.
|
||||
|
|
Loading…
Reference in New Issue