test(gw): eliminate side effect between tests

This commit is contained in:
JianBo He 2021-10-15 14:07:50 +08:00
parent 1cf833e1c0
commit 6f0d0ab473
4 changed files with 7 additions and 2 deletions

View File

@ -365,7 +365,7 @@ pre_config_update(UnknownReq, _RawConf) ->
emqx_config:config(), emqx_config:app_envs())
-> ok | {ok, Result::any()} | {error, Reason::term()}.
post_config_update(Req, NewConfig, OldConfig, _AppEnvs) ->
post_config_update(Req, NewConfig, OldConfig, _AppEnvs) when is_tuple(Req) ->
[_Tag, GwName0|_] = tuple_to_list(Req),
GwName = binary_to_existing_atom(GwName0),
@ -379,4 +379,6 @@ post_config_update(Req, NewConfig, OldConfig, _AppEnvs) ->
emqx_gateway:load(GwName, New);
{New, Old} when is_map(New), is_map(Old) ->
emqx_gateway:update(GwName, New)
end.
end;
post_config_update(_Req, _NewConfig, _OldConfig, _AppEnvs) ->
ok.

View File

@ -58,6 +58,7 @@ set_special_cfg(_) ->
ok.
end_per_suite(Config) ->
{ok, _} = emqx:remove_config([<<"gateway">>,<<"coap">>]),
emqx_common_test_helpers:stop_apps([emqx_gateway]),
Config.

View File

@ -60,6 +60,7 @@ init_per_group(GrpName, Cfg) ->
[{servers, Svrs}, {listener_type, GrpName} | Cfg].
end_per_group(_, Cfg) ->
{ok, _} = emqx:remove_config([gateway, exproto]),
emqx_common_test_helpers:stop_apps([emqx_gateway]),
emqx_exproto_echo_svr:stop(proplists:get_value(servers, Cfg)).

View File

@ -87,6 +87,7 @@ init_per_suite(Config) ->
Config.
end_per_suite(_) ->
{ok, _} = emqx:remove_config([gateway, mqttsn]),
emqx_common_test_helpers:stop_apps([emqx_gateway]).
%%--------------------------------------------------------------------