test: move tests into splited gateway dirs
This commit is contained in:
parent
159bcf329c
commit
786f030958
|
@ -19,7 +19,7 @@
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
|
|
||||||
-include("src/mqttsn/include/emqx_sn.hrl").
|
-include("emqx_mqttsn.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -30,11 +30,11 @@ all() ->
|
||||||
emqx_common_test_helpers:all(?MODULE).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
parse(D) ->
|
parse(D) ->
|
||||||
{ok, P, _Rest, _State} = emqx_sn_frame:parse(D, #{}),
|
{ok, P, _Rest, _State} = emqx_mqttsn_frame:parse(D, #{}),
|
||||||
P.
|
P.
|
||||||
|
|
||||||
serialize_pkt(P) ->
|
serialize_pkt(P) ->
|
||||||
emqx_sn_frame:serialize_pkt(P, #{}).
|
emqx_mqttsn_frame:serialize_pkt(P, #{}).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Test cases
|
%% Test cases
|
|
@ -27,7 +27,7 @@
|
||||||
]
|
]
|
||||||
).
|
).
|
||||||
|
|
||||||
-include("src/mqttsn/include/emqx_sn.hrl").
|
-include("emqx_mqttsn.hrl").
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
@ -97,6 +97,7 @@ all() ->
|
||||||
emqx_common_test_helpers:all(?MODULE).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
|
application:load(emqx_mqttsn),
|
||||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
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]),
|
emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_authn, emqx_gateway]),
|
||||||
Config.
|
Config.
|
||||||
|
@ -270,7 +271,7 @@ t_subscribe_case03(_) ->
|
||||||
%% In this case We use predefined topic name to register and subscribe,
|
%% 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
|
%% and expect to receive the corresponding predefined topic id but not a new
|
||||||
%% generated topic id from broker. We design this case to illustrate
|
%% 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.
|
%% topics.
|
||||||
%%
|
%%
|
||||||
%% Once we give more restrictions to different topic id type, this case
|
%% Once we give more restrictions to different topic id type, this case
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
-define(REGISTRY, emqx_sn_registry).
|
-define(REGISTRY, emqx_mqttsn_registry).
|
||||||
-define(MAX_PREDEF_ID, 2).
|
-define(MAX_PREDEF_ID, 2).
|
||||||
-define(PREDEF_TOPICS, [
|
-define(PREDEF_TOPICS, [
|
||||||
#{id => 1, topic => <<"/predefined/topic/name/hello">>},
|
#{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(<<"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 + 1, ?REGISTRY:lookup_topic_id(Reg, <<"ClientId">>, <<"Topic1">>)),
|
||||||
?assertEqual(?MAX_PREDEF_ID + 2, ?REGISTRY:lookup_topic_id(Reg, <<"ClientId">>, <<"Topic2">>)),
|
?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 + 1)),
|
||||||
?assertEqual(undefined, ?REGISTRY:lookup_topic(Reg, <<"ClientId">>, ?MAX_PREDEF_ID + 2)),
|
?assertEqual(undefined, ?REGISTRY:lookup_topic(Reg, <<"ClientId">>, ?MAX_PREDEF_ID + 2)),
|
||||||
?assertEqual(undefined, ?REGISTRY:lookup_topic_id(Reg, <<"ClientId">>, <<"Topic1">>)),
|
?assertEqual(undefined, ?REGISTRY:lookup_topic_id(Reg, <<"ClientId">>, <<"Topic1">>)),
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
-module(emqx_sn_proper_types).
|
-module(emqx_sn_proper_types).
|
||||||
|
|
||||||
-include("src/mqttsn/include/emqx_sn.hrl").
|
-include("emqx_mqttsn.hrl").
|
||||||
-include_lib("proper/include/proper.hrl").
|
-include_lib("proper/include/proper.hrl").
|
||||||
|
|
||||||
-compile({no_auto_import, [register/1]}).
|
-compile({no_auto_import, [register/1]}).
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
-module(prop_emqx_sn_frame).
|
-module(prop_emqx_sn_frame).
|
||||||
|
|
||||||
-include("src/mqttsn/include/emqx_sn.hrl").
|
-include("emqx_mqttsn.hrl").
|
||||||
-include_lib("proper/include/proper.hrl").
|
-include_lib("proper/include/proper.hrl").
|
||||||
|
|
||||||
-compile({no_auto_import, [register/1]}).
|
-compile({no_auto_import, [register/1]}).
|
||||||
|
@ -32,11 +32,11 @@
|
||||||
).
|
).
|
||||||
|
|
||||||
parse(D) ->
|
parse(D) ->
|
||||||
{ok, P, _Rest, _State} = emqx_sn_frame:parse(D, #{}),
|
{ok, P, _Rest, _State} = emqx_mqttsn_frame:parse(D, #{}),
|
||||||
P.
|
P.
|
||||||
|
|
||||||
serialize(P) ->
|
serialize(P) ->
|
||||||
emqx_sn_frame:serialize_pkt(P, #{}).
|
emqx_mqttsn_frame:serialize_pkt(P, #{}).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Properties
|
%% Properties
|
|
@ -17,7 +17,7 @@
|
||||||
-module(emqx_stomp_SUITE).
|
-module(emqx_stomp_SUITE).
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include("src/stomp/include/emqx_stomp.hrl").
|
-include("emqx_stomp.hrl").
|
||||||
|
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
|
@ -53,6 +53,7 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
init_per_suite(Cfg) ->
|
init_per_suite(Cfg) ->
|
||||||
|
application:load(emqx_stomp),
|
||||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||||
emqx_mgmt_api_test_util:init_suite([emqx_authn, emqx_gateway]),
|
emqx_mgmt_api_test_util:init_suite([emqx_authn, emqx_gateway]),
|
||||||
Cfg.
|
Cfg.
|
Loading…
Reference in New Issue