Merge pull request #13258 from HJianBo/fix-boot-order-for-gws
fix: gateway app must depends on all auth apps
This commit is contained in:
commit
23acbb664e
|
@ -4,7 +4,21 @@
|
|||
{vsn, "0.1.33"},
|
||||
{registered, []},
|
||||
{mod, {emqx_gateway_app, []}},
|
||||
{applications, [kernel, stdlib, emqx, emqx_auth, emqx_ctl]},
|
||||
{applications, [
|
||||
kernel,
|
||||
stdlib,
|
||||
emqx,
|
||||
emqx_auth,
|
||||
emqx_ctl,
|
||||
emqx_auth_http,
|
||||
emqx_auth_mnesia,
|
||||
emqx_auth_jwt,
|
||||
emqx_auth_mysql,
|
||||
emqx_auth_postgresql,
|
||||
emqx_auth_mongodb,
|
||||
emqx_auth_redis,
|
||||
emqx_auth_ldap
|
||||
]},
|
||||
{env, []},
|
||||
{modules, []},
|
||||
{licenses, ["Apache 2.0"]},
|
||||
|
|
|
@ -36,10 +36,7 @@ init_per_suite(Config) ->
|
|||
Apps = emqx_cth_suite:start(
|
||||
[
|
||||
{emqx_conf, ?CONF_DEFAULT},
|
||||
emqx_gateway,
|
||||
emqx_auth,
|
||||
emqx_auth_redis,
|
||||
emqx_auth_mnesia
|
||||
emqx_gateway
|
||||
],
|
||||
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||
),
|
||||
|
@ -50,25 +47,6 @@ end_per_suite(Config) ->
|
|||
emqx_config:delete_override_conf_files(),
|
||||
ok.
|
||||
|
||||
init_per_testcase(t_get_basic_usage_info_2, Config) ->
|
||||
DataDir = ?config(data_dir, Config),
|
||||
application:stop(emqx_gateway),
|
||||
ok = setup_fake_usage_data(DataDir),
|
||||
Config;
|
||||
init_per_testcase(_TestCase, Config) ->
|
||||
Config.
|
||||
|
||||
end_per_testcase(t_get_basic_usage_info_2, _Config) ->
|
||||
emqx_gateway_cm:unregister_channel(lwm2m, <<"client_id">>),
|
||||
emqx_config:put([gateway], #{}),
|
||||
emqx_common_test_helpers:stop_apps([emqx_gateway]),
|
||||
emqx_config:erase(gateway),
|
||||
emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_common_test_helpers:start_apps([emqx_gateway]),
|
||||
ok;
|
||||
end_per_testcase(_TestCase, _Config) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% cases
|
||||
%%--------------------------------------------------------------------
|
||||
|
@ -160,27 +138,8 @@ t_get_basic_usage_info_1(_Config) ->
|
|||
}
|
||||
},
|
||||
emqx_gateway:get_basic_usage_info()
|
||||
).
|
||||
|
||||
t_get_basic_usage_info_2(_Config) ->
|
||||
?assertEqual(
|
||||
#{
|
||||
lwm2m =>
|
||||
#{
|
||||
authn => <<"password_based:redis">>,
|
||||
listeners =>
|
||||
[
|
||||
#{
|
||||
authn =>
|
||||
<<"password_based:built_in_database">>,
|
||||
type => udp
|
||||
}
|
||||
],
|
||||
num_clients => 1
|
||||
}
|
||||
},
|
||||
emqx_gateway:get_basic_usage_info()
|
||||
).
|
||||
),
|
||||
ok = emqx_gateway:unload(?GWNAME).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% helper functions
|
||||
|
|
|
@ -48,8 +48,6 @@ init_per_suite(Conf) ->
|
|||
Apps = emqx_cth_suite:start(
|
||||
[
|
||||
emqx_conf,
|
||||
emqx_auth,
|
||||
emqx_auth_mnesia,
|
||||
emqx_management,
|
||||
{emqx_dashboard, "dashboard.listeners.http { enable = true, bind = 18083 }"},
|
||||
{emqx_gateway, ?CONF_DEFAULT}
|
||||
|
@ -62,7 +60,8 @@ init_per_suite(Conf) ->
|
|||
|
||||
end_per_suite(Conf) ->
|
||||
_ = emqx_common_test_http:delete_default_app(),
|
||||
ok = emqx_cth_suite:stop(proplists:get_value(suite_apps, Conf)).
|
||||
ok = emqx_cth_suite:stop(proplists:get_value(suite_apps, Conf)),
|
||||
emqx_config:delete_override_conf_files().
|
||||
|
||||
init_per_testcase(t_gateway_fail, Config) ->
|
||||
meck:expect(
|
||||
|
|
|
@ -57,8 +57,6 @@ init_per_group(AuthName, Conf) ->
|
|||
Apps = emqx_cth_suite:start(
|
||||
[
|
||||
emqx_conf,
|
||||
emqx_auth,
|
||||
emqx_auth_http,
|
||||
emqx_management,
|
||||
{emqx_dashboard, "dashboard.listeners.http { enable = true, bind = 18083 }"},
|
||||
{emqx_gateway, emqx_gateway_auth_ct:list_gateway_conf()}
|
||||
|
@ -73,6 +71,7 @@ init_per_group(AuthName, Conf) ->
|
|||
end_per_group(AuthName, Conf) ->
|
||||
ok = emqx_gateway_auth_ct:stop_auth(AuthName),
|
||||
_ = emqx_common_test_http:delete_default_app(),
|
||||
emqx_config:delete_override_conf_files(),
|
||||
ok = emqx_cth_suite:stop(?config(group_apps, Conf)),
|
||||
Conf.
|
||||
|
||||
|
|
|
@ -57,8 +57,6 @@ init_per_group(AuthName, Conf) ->
|
|||
Apps = emqx_cth_suite:start(
|
||||
[
|
||||
{emqx_conf, "authorization { no_match = deny, cache { enable = false } }"},
|
||||
emqx_auth,
|
||||
emqx_auth_http,
|
||||
{emqx_gateway, emqx_gateway_auth_ct:list_gateway_conf()}
|
||||
| emqx_gateway_test_utils:all_gateway_apps()
|
||||
],
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
-compile(nowarn_export_all).
|
||||
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
|
||||
-define(GP(S), begin
|
||||
S,
|
||||
|
@ -29,13 +30,6 @@
|
|||
end
|
||||
end).
|
||||
|
||||
%% this parses to #{}, will not cause config cleanup
|
||||
%% so we will need call emqx_config:erase
|
||||
-define(CONF_DEFAULT, <<
|
||||
"\n"
|
||||
"gateway {}\n"
|
||||
>>).
|
||||
|
||||
%% The config with json format for mqtt-sn gateway
|
||||
-define(CONF_MQTTSN,
|
||||
"\n"
|
||||
|
@ -65,13 +59,18 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
init_per_suite(Conf) ->
|
||||
emqx_config:erase(gateway),
|
||||
emqx_gateway_test_utils:load_all_gateway_apps(),
|
||||
emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||
emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_auth, emqx_gateway]),
|
||||
Conf.
|
||||
Apps = emqx_cth_suite:start(
|
||||
[
|
||||
{emqx_conf, <<"gateway {}">>},
|
||||
emqx_gateway
|
||||
],
|
||||
#{work_dir => emqx_cth_suite:work_dir(Conf)}
|
||||
),
|
||||
[{suite_apps, Apps} | Conf].
|
||||
|
||||
end_per_suite(Conf) ->
|
||||
emqx_mgmt_api_test_util:end_suite([emqx_gateway, emqx_auth, emqx_conf]),
|
||||
Conf.
|
||||
emqx_cth_suite:stop(?config(suite_apps, Conf)),
|
||||
emqx_config:delete_override_conf_files().
|
||||
|
||||
init_per_testcase(_, Conf) ->
|
||||
Self = self(),
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
).
|
||||
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Setups
|
||||
|
@ -38,12 +39,17 @@ all() ->
|
|||
|
||||
init_per_suite(Conf) ->
|
||||
emqx_gateway_test_utils:load_all_gateway_apps(),
|
||||
emqx_common_test_helpers:load_config(emqx_gateway_schema, <<"gateway {}">>),
|
||||
emqx_common_test_helpers:start_apps([emqx_conf, emqx_auth, emqx_auth_mnesia, emqx_gateway]),
|
||||
Conf.
|
||||
Apps = emqx_cth_suite:start(
|
||||
[
|
||||
{emqx_conf, <<"gateway {}">>},
|
||||
emqx_gateway
|
||||
],
|
||||
#{work_dir => emqx_cth_suite:work_dir(Conf)}
|
||||
),
|
||||
[{suite_apps, Apps} | Conf].
|
||||
|
||||
end_per_suite(_Conf) ->
|
||||
emqx_common_test_helpers:stop_apps([emqx_gateway, emqx_auth, emqx_auth_mnesia, emqx_conf]),
|
||||
end_per_suite(Conf) ->
|
||||
emqx_cth_suite:stop(?config(suite_apps, Conf)),
|
||||
emqx_config:delete_override_conf_files().
|
||||
|
||||
init_per_testcase(_CaseName, Conf) ->
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fix an issue where the MQTT-SN gateway would not restart correctly due to incorrect startup order of gateway dependencies.
|
Loading…
Reference in New Issue