summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2020-03-30 21:40:29 +0300
committerMichael Klishin <michael@clojurewerkz.org>2020-03-30 21:40:29 +0300
commit807392e81b1840f90554ae8f9ff76f2a231fe671 (patch)
tree8f072e3bc56fa90acff5afac702348b32f2254bd
parent23aa6398d62b01eebb7c31ae859ac2e3d43fa3d2 (diff)
downloadrabbitmq-server-git-807392e81b1840f90554ae8f9ff76f2a231fe671.tar.gz
Move VM memory monitor unit tests into their own suite
-rw-r--r--test/unit_SUITE.erl42
-rw-r--r--test/unit_vm_memory_monitor_SUITE.erl50
2 files changed, 51 insertions, 41 deletions
diff --git a/test/unit_SUITE.erl b/test/unit_SUITE.erl
index 6a7482bab8..f1bf6d1241 100644
--- a/test/unit_SUITE.erl
+++ b/test/unit_SUITE.erl
@@ -58,10 +58,7 @@ groups() ->
check_shutdown_ignored
]},
table_codec,
- unfold,
- {vm_memory_monitor, [parallel], [
- parse_line_linux
- ]}
+ unfold
]},
{sequential_tests, [], [
pg_local,
@@ -608,43 +605,6 @@ test_simple_n_element_queue(N) ->
{true, false, N, ToListRes, Items} = test_priority_queue(Q),
passed.
-%% ---------------------------------------------------------------------------
-%% resource_monitor.
-%% ---------------------------------------------------------------------------
-
-parse_information_unit(_Config) ->
- lists:foreach(fun ({S, V}) ->
- V = rabbit_resource_monitor_misc:parse_information_unit(S)
- end,
- [
- {"1000", {ok, 1000}},
-
- {"10kB", {ok, 10000}},
- {"10MB", {ok, 10000000}},
- {"10GB", {ok, 10000000000}},
-
- {"10kiB", {ok, 10240}},
- {"10MiB", {ok, 10485760}},
- {"10GiB", {ok, 10737418240}},
-
- {"10k", {ok, 10240}},
- {"10M", {ok, 10485760}},
- {"10G", {ok, 10737418240}},
-
- {"10KB", {ok, 10000}},
- {"10K", {ok, 10240}},
- {"10m", {ok, 10485760}},
- {"10Mb", {ok, 10000000}},
-
- {"0MB", {ok, 0}},
-
- {"10 k", {error, parse_error}},
- {"MB", {error, parse_error}},
- {"", {error, parse_error}},
- {"0.5GB", {error, parse_error}},
- {"10TB", {error, parse_error}}
- ]),
- passed.
%% ---------------------------------------------------------------------------
%% supervisor2.
diff --git a/test/unit_vm_memory_monitor_SUITE.erl b/test/unit_vm_memory_monitor_SUITE.erl
new file mode 100644
index 0000000000..7c04946ce9
--- /dev/null
+++ b/test/unit_vm_memory_monitor_SUITE.erl
@@ -0,0 +1,50 @@
+%% The contents of this file are subject to the Mozilla Public License
+%% Version 1.1 (the "License"); you may not use this file except in
+%% compliance with the License. You may obtain a copy of the License at
+%% https://www.mozilla.org/MPL/
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+%% License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% The Original Code is RabbitMQ.
+%%
+%% The Initial Developer of the Original Code is GoPivotal, Inc.
+%% Copyright (c) 2011-2020 VMware, Inc. or its affiliates. All rights reserved.
+%%
+
+-module(unit_vm_memory_monitor_SUITE).
+
+-include_lib("common_test/include/ct.hrl").
+-include_lib("eunit/include/eunit.hrl").
+-include_lib("rabbit_common/include/rabbit.hrl").
+-include_lib("rabbit_common/include/rabbit_framing.hrl").
+
+-compile(export_all).
+
+all() ->
+ [
+ {group, parallel_tests}
+ ].
+
+groups() ->
+ [
+ {parallel_tests, [parallel], [
+ {vm_memory_monitor, [parallel], [
+ parse_line_linux
+ ]}
+ ]}
+ ].
+
+parse_line_linux(_Config) ->
+ lists:foreach(fun ({S, {K, V}}) ->
+ {K, V} = vm_memory_monitor:parse_line_linux(S)
+ end,
+ [{"MemTotal: 0 kB", {'MemTotal', 0}},
+ {"MemTotal: 502968 kB ", {'MemTotal', 515039232}},
+ {"MemFree: 178232 kB", {'MemFree', 182509568}},
+ {"MemTotal: 50296888", {'MemTotal', 50296888}},
+ {"MemTotal 502968 kB", {'MemTotal', 515039232}},
+ {"MemTotal 50296866 ", {'MemTotal', 50296866}}]),
+ ok.