Merged emqx_misc_SUITE to emqx_misc_tests (#1890)

* Merged emqx_misc_SUITE to emqx_misc_tests
This commit is contained in:
huangdan 2018-10-19 15:46:25 +08:00 committed by spring2maz
parent 4c40f75f4b
commit 73658b3953
3 changed files with 26 additions and 47 deletions

View File

@ -35,9 +35,10 @@ EUNIT_OPTS = verbose
# CT_SUITES = emqx_frame # CT_SUITES = emqx_frame
## emqx_trie emqx_router emqx_frame emqx_mqtt_compat ## emqx_trie emqx_router emqx_frame emqx_mqtt_compat
CT_SUITES = emqx emqx_client emqx_zone emqx_banned emqx_connection emqx_session \ CT_SUITES = emqx emqx_client emqx_zone emqx_banned emqx_connection emqx_session \
emqx_access emqx_broker emqx_cm emqx_frame emqx_guid emqx_inflight emqx_json \ emqx_access emqx_broker emqx_cm emqx_frame emqx_guid emqx_inflight emqx_json \
emqx_keepalive emqx_lib emqx_metrics emqx_misc emqx_mod emqx_mqtt_caps \ emqx_keepalive emqx_lib emqx_metrics emqx_mod emqx_mqtt_caps \
emqx_mqtt_props emqx_mqueue emqx_net emqx_pqueue emqx_router emqx_sm \ emqx_mqtt_props emqx_mqueue emqx_net emqx_pqueue emqx_router emqx_sm \
emqx_tables emqx_time emqx_topic emqx_trie emqx_vm emqx_mountpoint \ emqx_tables emqx_time emqx_topic emqx_trie emqx_vm emqx_mountpoint \
emqx_listeners emqx_protocol emqx_pool emqx_shared_sub emqx_listeners emqx_protocol emqx_pool emqx_shared_sub

View File

@ -1,45 +0,0 @@
%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
-module(emqx_misc_SUITE).
-include_lib("eunit/include/eunit.hrl").
-compile(export_all).
-compile(nowarn_export_all).
-define(SOCKOPTS, [binary,
{packet, raw},
{reuseaddr, true},
{backlog, 512},
{nodelay, true}]).
all() -> [t_merge_opts].
t_merge_opts(_) ->
Opts = emqx_misc:merge_opts(?SOCKOPTS, [raw,
binary,
{backlog, 1024},
{nodelay, false},
{max_clients, 1024},
{acceptors, 16}]),
?assertEqual(1024, proplists:get_value(backlog, Opts)),
?assertEqual(1024, proplists:get_value(max_clients, Opts)),
[binary, raw,
{acceptors, 16},
{backlog, 1024},
{max_clients, 1024},
{nodelay, false},
{packet, raw},
{reuseaddr, true}] = lists:sort(Opts).

View File

@ -15,6 +15,30 @@
-module(emqx_misc_tests). -module(emqx_misc_tests).
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
-define(SOCKOPTS, [binary,
{packet, raw},
{reuseaddr, true},
{backlog, 512},
{nodelay, true}]).
t_merge_opts_test() ->
Opts = emqx_misc:merge_opts(?SOCKOPTS, [raw,
binary,
{backlog, 1024},
{nodelay, false},
{max_clients, 1024},
{acceptors, 16}]),
?assertEqual(1024, proplists:get_value(backlog, Opts)),
?assertEqual(1024, proplists:get_value(max_clients, Opts)),
[binary, raw,
{acceptors, 16},
{backlog, 1024},
{max_clients, 1024},
{nodelay, false},
{packet, raw},
{reuseaddr, true}] = lists:sort(Opts).
timer_cancel_flush_test() -> timer_cancel_flush_test() ->
Timer = emqx_misc:start_timer(0, foo), Timer = emqx_misc:start_timer(0, foo),
ok = emqx_misc:cancel_timer(Timer), ok = emqx_misc:cancel_timer(Timer),
@ -39,4 +63,3 @@ message_queue_too_long_test() ->
conn_proc_mng_policy(L) -> conn_proc_mng_policy(L) ->
emqx_misc:conn_proc_mng_policy(#{message_queue_len => L}). emqx_misc:conn_proc_mng_policy(#{message_queue_len => L}).