chore(gw): integrate emqx-conf
This commit is contained in:
parent
0b36b73ee1
commit
287859fe36
|
@ -224,10 +224,10 @@ remove_authn(GwName, ListenerRef) ->
|
||||||
|
|
||||||
%% @private
|
%% @private
|
||||||
update(Req) ->
|
update(Req) ->
|
||||||
res(emqx:update_config([gateway], Req)).
|
res(emqx_conf:update([gateway], Req, #{override_to => cluster})).
|
||||||
|
|
||||||
res({ok, _Result}) -> ok;
|
res({ok, _Result}) -> ok;
|
||||||
res({error, {pre_config_update,emqx_gateway_conf,Reason}}) -> {error, Reason};
|
res({error, {error, {pre_config_update,emqx_gateway_conf,Reason}}}) -> {error, Reason};
|
||||||
res({error, Reason}) -> {error, Reason}.
|
res({error, Reason}) -> {error, Reason}.
|
||||||
|
|
||||||
bin({LType, LName}) ->
|
bin({LType, LName}) ->
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
|
-define(CONF_DEFAULT, <<"
|
||||||
|
gateway {}
|
||||||
|
">>).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Setup
|
%% Setup
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -35,18 +39,12 @@
|
||||||
all() -> emqx_common_test_helpers:all(?MODULE).
|
all() -> emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Conf) ->
|
init_per_suite(Conf) ->
|
||||||
%% FIXME: Magic line. for saving gateway schema name for emqx_config
|
emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||||
emqx_config:init_load(emqx_gateway_schema, <<"gateway {}">>),
|
emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_authn, emqx_gateway]),
|
||||||
emqx_mgmt_api_test_util:init_suite([emqx_gateway]),
|
|
||||||
%% Start emqx-authn separately, due to emqx_authn_schema
|
|
||||||
%% not implementing the roots/0 method, it cannot be started with
|
|
||||||
%% emqx-ct-helpers at the moment.
|
|
||||||
{ok, _} = application:ensure_all_started(emqx_authn),
|
|
||||||
Conf.
|
Conf.
|
||||||
|
|
||||||
end_per_suite(Conf) ->
|
end_per_suite(Conf) ->
|
||||||
application:stop(emqx_authn),
|
emqx_mgmt_api_test_util:end_suite([emqx_gateway, emqx_authn, emqx_conf]),
|
||||||
emqx_mgmt_api_test_util:end_suite([emqx_gateway]),
|
|
||||||
Conf.
|
Conf.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
|
@ -34,15 +34,12 @@ all() ->
|
||||||
emqx_common_test_helpers:all(?MODULE).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Conf) ->
|
init_per_suite(Conf) ->
|
||||||
%% FIXME: Magic line. for saving gateway schema name for emqx_config
|
|
||||||
emqx_config:init_load(emqx_gateway_schema, <<"gateway {}">>),
|
emqx_config:init_load(emqx_gateway_schema, <<"gateway {}">>),
|
||||||
emqx_common_test_helpers:start_apps([emqx_gateway]),
|
emqx_common_test_helpers:start_apps([emqx_conf, emqx_authn, emqx_gateway]),
|
||||||
{ok, _} = application:ensure_all_started(emqx_authn),
|
|
||||||
Conf.
|
Conf.
|
||||||
|
|
||||||
end_per_suite(_Conf) ->
|
end_per_suite(_Conf) ->
|
||||||
application:stop(emqx_authn),
|
emqx_common_test_helpers:stop_apps([emqx_gateway, emqx_authn, emqx_conf]).
|
||||||
emqx_common_test_helpers:stop_apps([emqx_gateway]).
|
|
||||||
|
|
||||||
init_per_testcase(_CaseName, Conf) ->
|
init_per_testcase(_CaseName, Conf) ->
|
||||||
_ = emqx_gateway_conf:unload_gateway(stomp),
|
_ = emqx_gateway_conf:unload_gateway(stomp),
|
||||||
|
|
|
@ -150,12 +150,13 @@ groups() ->
|
||||||
].
|
].
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
emqx_common_test_helpers:start_apps([]),
|
emqx_common_test_helpers:start_apps([emqx_conf]),
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
timer:sleep(300),
|
timer:sleep(300),
|
||||||
emqx_common_test_helpers:stop_apps([]),
|
{ok, _} = emqx_conf:remove([<<"gateway">>,<<"lwm2m">>], #{}),
|
||||||
|
emqx_common_test_helpers:stop_apps([emqx_conf]),
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
init_per_testcase(_AllTestCase, Config) ->
|
init_per_testcase(_AllTestCase, Config) ->
|
||||||
|
|
|
@ -70,12 +70,13 @@ all() ->
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
ok = emqx_config:init_load(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||||
emqx_mgmt_api_test_util:init_suite([emqx_gateway]),
|
emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_gateway]),
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
timer:sleep(300),
|
timer:sleep(300),
|
||||||
emqx_mgmt_api_test_util:end_suite([emqx_gateway]),
|
{ok, _} = emqx_conf:remove([<<"gateway">>,<<"lwm2m">>], #{}),
|
||||||
|
emqx_mgmt_api_test_util:end_suite([emqx_gateway, emqx_conf]),
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
init_per_testcase(_AllTestCase, Config) ->
|
init_per_testcase(_AllTestCase, Config) ->
|
||||||
|
|
Loading…
Reference in New Issue