fix: ct failed again
This commit is contained in:
parent
fe5998d773
commit
d61b44ef97
|
@ -22,6 +22,7 @@
|
|||
-export([
|
||||
init_load/1,
|
||||
init_load/2,
|
||||
init_load/3,
|
||||
read_override_conf/1,
|
||||
delete_override_conf_files/0,
|
||||
check_config/2,
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
render_config_file/2,
|
||||
read_schema_configs/2,
|
||||
load_config/2,
|
||||
load_config/3,
|
||||
is_tcp_server_available/2,
|
||||
is_tcp_server_available/3
|
||||
]).
|
||||
|
@ -465,11 +466,19 @@ copy_certs(emqx_conf, Dest0) ->
|
|||
copy_certs(_, _) ->
|
||||
ok.
|
||||
|
||||
load_config(SchemaModule, Config) ->
|
||||
load_config(SchemaModule, Config, Opts) ->
|
||||
ConfigBin =
|
||||
case is_map(Config) of
|
||||
true -> jsx:encode(Config);
|
||||
false -> Config
|
||||
end,
|
||||
ok = emqx_config:delete_override_conf_files(),
|
||||
ok = emqx_config:init_load(SchemaModule, Config),
|
||||
ok = emqx_config:init_load(SchemaModule, ConfigBin, Opts),
|
||||
ok.
|
||||
|
||||
load_config(SchemaModule, Config) ->
|
||||
load_config(SchemaModule, Config, #{raw_with_default => false}).
|
||||
|
||||
-spec is_tcp_server_available(
|
||||
Host :: inet:socket_address() | inet:hostname(),
|
||||
Port :: inet:port_number()
|
||||
|
|
|
@ -142,8 +142,9 @@ setup_fake_telemetry_data() ->
|
|||
}
|
||||
}
|
||||
},
|
||||
ok = emqx_common_test_helpers:load_config(emqx_connector_schema, ConnectorConf),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_bridge_schema, Conf),
|
||||
Opts = #{raw_with_default => true},
|
||||
ok = emqx_common_test_helpers:load_config(emqx_connector_schema, ConnectorConf, Opts),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_bridge_schema, Conf, Opts),
|
||||
|
||||
ok = snabbkaffe:start_trace(),
|
||||
Predicate = fun(#{?snk_kind := K}) -> K =:= emqx_bridge_monitor_loaded_bridge end,
|
||||
|
|
|
@ -32,7 +32,9 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?BASE_CONF),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?BASE_CONF), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
|
||||
ok = emqx_common_test_helpers:start_apps(
|
||||
[emqx_conf, emqx_modules, emqx_dashboard],
|
||||
|
|
|
@ -29,7 +29,9 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Conf) ->
|
||||
emqx_common_test_helpers:load_config(emqx_modules_schema, <<"gateway {}">>),
|
||||
emqx_common_test_helpers:load_config(emqx_modules_schema, <<"gateway {}">>, #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
emqx_common_test_helpers:start_apps([emqx_conf, emqx_modules]),
|
||||
Conf.
|
||||
|
||||
|
|
|
@ -157,13 +157,17 @@ t_rewrite_re_error(_Config) ->
|
|||
ok.
|
||||
|
||||
t_list(_Config) ->
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?REWRITE), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
Expect = maps:get(<<"rewrite">>, ?REWRITE),
|
||||
?assertEqual(Expect, emqx_rewrite:list()),
|
||||
ok.
|
||||
|
||||
t_update(_Config) ->
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?REWRITE), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
Init = emqx_rewrite:list(),
|
||||
Rules = [
|
||||
#{
|
||||
|
@ -179,7 +183,9 @@ t_update(_Config) ->
|
|||
ok.
|
||||
|
||||
t_update_disable(_Config) ->
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?REWRITE), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
?assertEqual(ok, emqx_rewrite:update([])),
|
||||
timer:sleep(150),
|
||||
|
||||
|
@ -194,7 +200,9 @@ t_update_disable(_Config) ->
|
|||
ok.
|
||||
|
||||
t_update_re_failed(_Config) ->
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?REWRITE), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
Re = <<"*^test/*">>,
|
||||
Rules = [
|
||||
#{
|
||||
|
@ -249,7 +257,9 @@ receive_publish(Timeout) ->
|
|||
end.
|
||||
|
||||
init() ->
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?REWRITE),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?REWRITE), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
ok = emqx_rewrite:enable(),
|
||||
{ok, C} = emqtt:start_link([{clientid, <<"c1">>}, {username, <<"u1">>}]),
|
||||
{ok, _} = emqtt:connect(C),
|
||||
|
|
|
@ -33,7 +33,9 @@ init_per_testcase(_, Config) ->
|
|||
Config.
|
||||
|
||||
init_per_suite(Config) ->
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?BASE_CONF),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?BASE_CONF), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
|
||||
ok = emqx_common_test_helpers:start_apps(
|
||||
[emqx_conf, emqx_modules, emqx_dashboard],
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
|
||||
-import(proplists, [get_value/2]).
|
||||
|
||||
-define(BASE_CONF, #{
|
||||
<<"dealyed">> => <<"true">>,
|
||||
<<"max_delayed_messages">> => <<"0">>
|
||||
}).
|
||||
|
||||
all() -> emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
|
@ -36,6 +41,9 @@ init_per_suite(Config) ->
|
|||
emqx_common_test_helpers:deps_path(emqx_authz, "etc/acl.conf")
|
||||
end
|
||||
),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?BASE_CONF), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
emqx_common_test_helpers:start_apps(
|
||||
[emqx_conf, emqx_authn, emqx_authz, emqx_modules],
|
||||
fun set_special_configs/1
|
||||
|
@ -144,7 +152,9 @@ init_per_testcase(t_exhook_info, Config) ->
|
|||
{ok, _} = emqx_exhook_demo_svr:start(),
|
||||
{ok, Sock} = gen_tcp:connect("localhost", 9000, [], 3000),
|
||||
_ = gen_tcp:close(Sock),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_exhook_schema, ExhookConf),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_exhook_schema, ExhookConf, #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
{ok, _} = application:ensure_all_started(emqx_exhook),
|
||||
Config;
|
||||
init_per_testcase(t_cluster_uuid, Config) ->
|
||||
|
@ -166,6 +176,9 @@ init_per_testcase(t_uuid_restored_from_file, Config) ->
|
|||
%% clear the UUIDs in the DB
|
||||
{atomic, ok} = mria:clear_table(emqx_telemetry),
|
||||
emqx_common_test_helpers:stop_apps([emqx_conf, emqx_authn, emqx_authz, emqx_modules]),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?BASE_CONF), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
emqx_common_test_helpers:start_apps(
|
||||
[emqx_conf, emqx_authn, emqx_authz, emqx_modules],
|
||||
fun set_special_configs/1
|
||||
|
@ -319,6 +332,9 @@ t_uuid_saved_to_file(_Config) ->
|
|||
%% clear the UUIDs in the DB
|
||||
{atomic, ok} = mria:clear_table(emqx_telemetry),
|
||||
emqx_common_test_helpers:stop_apps([emqx_conf, emqx_authn, emqx_authz, emqx_modules]),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?BASE_CONF), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
emqx_common_test_helpers:start_apps(
|
||||
[emqx_conf, emqx_authn, emqx_authz, emqx_modules],
|
||||
fun set_special_configs/1
|
||||
|
@ -841,6 +857,12 @@ setup_slave(Node) ->
|
|||
(_) ->
|
||||
ok
|
||||
end,
|
||||
ok = rpc:call(
|
||||
Node,
|
||||
emqx_common_test_helpers,
|
||||
load_config,
|
||||
[emqx_modules_schema, jsx:encode(?BASE_CONF), #{raw_with_default => true}]
|
||||
),
|
||||
ok = rpc:call(
|
||||
Node,
|
||||
emqx_common_test_helpers,
|
||||
|
|
|
@ -29,7 +29,9 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?BASE_CONF),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?BASE_CONF), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
|
||||
ok = emqx_common_test_helpers:start_apps(
|
||||
[emqx_conf, emqx_authn, emqx_authz, emqx_modules, emqx_dashboard],
|
||||
|
|
|
@ -29,7 +29,9 @@ 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_conf, emqx_modules]),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?TOPIC),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?TOPIC), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
|
|
|
@ -40,7 +40,9 @@ init_per_testcase(_, Config) ->
|
|||
Config.
|
||||
|
||||
init_per_suite(Config) ->
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, ?BASE_CONF),
|
||||
ok = emqx_common_test_helpers:load_config(emqx_modules_schema, jsx:encode(?BASE_CONF), #{
|
||||
raw_with_default => true
|
||||
}),
|
||||
|
||||
ok = emqx_common_test_helpers:start_apps(
|
||||
[emqx_conf, emqx_modules, emqx_dashboard],
|
||||
|
|
Loading…
Reference in New Issue