test: move tests into splited gateway dirs

This commit is contained in:
JianBo He 2023-03-30 11:50:41 +08:00
parent 159bcf329c
commit 786f030958
27 changed files with 14 additions and 12 deletions

View File

@ -19,7 +19,7 @@
-compile(export_all).
-compile(nowarn_export_all).
-include("src/mqttsn/include/emqx_sn.hrl").
-include("emqx_mqttsn.hrl").
-include_lib("eunit/include/eunit.hrl").
%%--------------------------------------------------------------------
@ -30,11 +30,11 @@ all() ->
emqx_common_test_helpers:all(?MODULE).
parse(D) ->
{ok, P, _Rest, _State} = emqx_sn_frame:parse(D, #{}),
{ok, P, _Rest, _State} = emqx_mqttsn_frame:parse(D, #{}),
P.
serialize_pkt(P) ->
emqx_sn_frame:serialize_pkt(P, #{}).
emqx_mqttsn_frame:serialize_pkt(P, #{}).
%%--------------------------------------------------------------------
%% Test cases

View File

@ -27,7 +27,7 @@
]
).
-include("src/mqttsn/include/emqx_sn.hrl").
-include("emqx_mqttsn.hrl").
-include_lib("eunit/include/eunit.hrl").
-include_lib("common_test/include/ct.hrl").
@ -97,6 +97,7 @@ all() ->
emqx_common_test_helpers:all(?MODULE).
init_per_suite(Config) ->
application:load(emqx_mqttsn),
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_authn, emqx_gateway]),
Config.
@ -270,7 +271,7 @@ t_subscribe_case03(_) ->
%% In this case We use predefined topic name to register and subscribe,
%% and expect to receive the corresponding predefined topic id but not a new
%% generated topic id from broker. We design this case to illustrate
%% emqx_sn_gateway's compatibility of dealing with predefined and normal
%% MQTT-SN Gateway's compatibility of dealing with predefined and normal
%% topics.
%%
%% Once we give more restrictions to different topic id type, this case

View File

@ -21,7 +21,7 @@
-include_lib("eunit/include/eunit.hrl").
-define(REGISTRY, emqx_sn_registry).
-define(REGISTRY, emqx_mqttsn_registry).
-define(MAX_PREDEF_ID, 2).
-define(PREDEF_TOPICS, [
#{id => 1, topic => <<"/predefined/topic/name/hello">>},
@ -66,7 +66,7 @@ t_register(Config) ->
?assertEqual(<<"Topic2">>, ?REGISTRY:lookup_topic(Reg, <<"ClientId">>, ?MAX_PREDEF_ID + 2)),
?assertEqual(?MAX_PREDEF_ID + 1, ?REGISTRY:lookup_topic_id(Reg, <<"ClientId">>, <<"Topic1">>)),
?assertEqual(?MAX_PREDEF_ID + 2, ?REGISTRY:lookup_topic_id(Reg, <<"ClientId">>, <<"Topic2">>)),
emqx_sn_registry:unregister_topic(Reg, <<"ClientId">>),
emqx_mqttsn_registry:unregister_topic(Reg, <<"ClientId">>),
?assertEqual(undefined, ?REGISTRY:lookup_topic(Reg, <<"ClientId">>, ?MAX_PREDEF_ID + 1)),
?assertEqual(undefined, ?REGISTRY:lookup_topic(Reg, <<"ClientId">>, ?MAX_PREDEF_ID + 2)),
?assertEqual(undefined, ?REGISTRY:lookup_topic_id(Reg, <<"ClientId">>, <<"Topic1">>)),

View File

@ -16,7 +16,7 @@
-module(emqx_sn_proper_types).
-include("src/mqttsn/include/emqx_sn.hrl").
-include("emqx_mqttsn.hrl").
-include_lib("proper/include/proper.hrl").
-compile({no_auto_import, [register/1]}).

View File

@ -16,7 +16,7 @@
-module(prop_emqx_sn_frame).
-include("src/mqttsn/include/emqx_sn.hrl").
-include("emqx_mqttsn.hrl").
-include_lib("proper/include/proper.hrl").
-compile({no_auto_import, [register/1]}).
@ -32,11 +32,11 @@
).
parse(D) ->
{ok, P, _Rest, _State} = emqx_sn_frame:parse(D, #{}),
{ok, P, _Rest, _State} = emqx_mqttsn_frame:parse(D, #{}),
P.
serialize(P) ->
emqx_sn_frame:serialize_pkt(P, #{}).
emqx_mqttsn_frame:serialize_pkt(P, #{}).
%%--------------------------------------------------------------------
%% Properties

View File

@ -17,7 +17,7 @@
-module(emqx_stomp_SUITE).
-include_lib("eunit/include/eunit.hrl").
-include("src/stomp/include/emqx_stomp.hrl").
-include("emqx_stomp.hrl").
-compile(export_all).
-compile(nowarn_export_all).
@ -53,6 +53,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
%%--------------------------------------------------------------------
init_per_suite(Cfg) ->
application:load(emqx_stomp),
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
emqx_mgmt_api_test_util:init_suite([emqx_authn, emqx_gateway]),
Cfg.