From 422c3525d83822dc1b3b0af643e8b04f72c0a3a0 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Fri, 1 Nov 2019 20:12:18 +0800 Subject: [PATCH] Move test case of checking oom to emqx_misc_SUITE --- test/emqx_misc_SUITE.erl | 8 +++++++ test/emqx_oom_SUITE.erl | 47 ---------------------------------------- 2 files changed, 8 insertions(+), 47 deletions(-) delete mode 100644 test/emqx_oom_SUITE.erl diff --git a/test/emqx_misc_SUITE.erl b/test/emqx_misc_SUITE.erl index 98bb7b072..cb7661a3e 100644 --- a/test/emqx_misc_SUITE.erl +++ b/test/emqx_misc_SUITE.erl @@ -119,6 +119,14 @@ t_index_of(_) -> end, ?assertEqual(3, emqx_misc:index_of(a, [b, c, a, e, f])). +t_check(_) -> + Policy = #{message_queue_len => 10, + max_heap_size => 1024 * 1024 * 8}, + [self() ! {msg, I} || I <- lists:seq(1, 5)], + ?assertEqual(ok, emqx_misc:check_oom(Policy)), + [self() ! {msg, I} || I <- lists:seq(1, 6)], + ?assertEqual({shutdown, message_queue_too_long}, emqx_misc:check_oom(Policy)). + drain() -> drain([]). diff --git a/test/emqx_oom_SUITE.erl b/test/emqx_oom_SUITE.erl deleted file mode 100644 index a44d32d2c..000000000 --- a/test/emqx_oom_SUITE.erl +++ /dev/null @@ -1,47 +0,0 @@ -%%-------------------------------------------------------------------- -%% Copyright (c) 2019 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_oom_SUITE). - --compile(export_all). --compile(nowarn_export_all). - --include_lib("eunit/include/eunit.hrl"). - -all() -> emqx_ct:all(?MODULE). - -t_init(_) -> - Opts = #{message_queue_len => 10, - max_heap_size => 1024*1024*8 - }, - Oom = emqx_oom:init(Opts), - ?assertEqual(#{message_queue_len => 10, - max_heap_size => 1024*1024 - }, emqx_oom:info(Oom)). - -t_check(_) -> - Opts = #{message_queue_len => 10, - max_heap_size => 1024*1024*8 - }, - Oom = emqx_oom:init(Opts), - [self() ! {msg, I} || I <- lists:seq(1, 5)], - ?assertEqual(ok, emqx_oom:check(Oom)), - [self() ! {msg, I} || I <- lists:seq(1, 6)], - ?assertEqual({shutdown, message_queue_too_long}, emqx_oom:check(Oom)). - -% t_info(_) -> -% error('TODO'). -