|
| 1 | +%% This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | +%% License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | +%% file, You can obtain one at https://mozilla.org/MPL/2.0/. |
| 4 | +%% |
| 5 | +%% Copyright (c) 2007-2026 Broadcom. All Rights Reserved. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. All rights reserved. |
| 6 | +%% |
| 7 | + |
| 8 | +-module(unit_rabbit_vm_SUITE). |
| 9 | + |
| 10 | +-include_lib("eunit/include/eunit.hrl"). |
| 11 | + |
| 12 | +-compile(export_all). |
| 13 | + |
| 14 | +all() -> |
| 15 | + [ |
| 16 | + {group, sequential_tests} |
| 17 | + ]. |
| 18 | + |
| 19 | +groups() -> |
| 20 | + [ |
| 21 | + {sequential_tests, [], [ |
| 22 | + memory_breakdown_non_negative |
| 23 | + ]} |
| 24 | + ]. |
| 25 | + |
| 26 | +%% ------------------------------------------------------------------- |
| 27 | +%% Test suite setup/teardown |
| 28 | +%% ------------------------------------------------------------------- |
| 29 | + |
| 30 | +init_per_suite(Config) -> |
| 31 | + rabbit_ct_helpers:log_environment(), |
| 32 | + rabbit_ct_helpers:run_setup_steps(Config). |
| 33 | + |
| 34 | +end_per_suite(Config) -> |
| 35 | + rabbit_ct_helpers:run_teardown_steps(Config). |
| 36 | + |
| 37 | +init_per_group(Group, Config) -> |
| 38 | + Config1 = rabbit_ct_helpers:set_config(Config, [ |
| 39 | + {rmq_nodename_suffix, Group}, |
| 40 | + {rmq_nodes_count, 1} |
| 41 | + ]), |
| 42 | + rabbit_ct_helpers:run_steps(Config1, |
| 43 | + rabbit_ct_broker_helpers:setup_steps() ++ |
| 44 | + rabbit_ct_client_helpers:setup_steps()). |
| 45 | + |
| 46 | +end_per_group(_Group, Config) -> |
| 47 | + rabbit_ct_helpers:run_steps(Config, |
| 48 | + rabbit_ct_client_helpers:teardown_steps() ++ |
| 49 | + rabbit_ct_broker_helpers:teardown_steps()). |
| 50 | + |
| 51 | +init_per_testcase(Testcase, Config) -> |
| 52 | + rabbit_ct_helpers:testcase_started(Config, Testcase). |
| 53 | + |
| 54 | +end_per_testcase(Testcase, Config) -> |
| 55 | + rabbit_ct_helpers:testcase_finished(Config, Testcase). |
| 56 | + |
| 57 | +%% ------------------------------------------------------------------- |
| 58 | +%% Test cases |
| 59 | +%% ------------------------------------------------------------------- |
| 60 | + |
| 61 | +memory_breakdown_non_negative(Config) -> |
| 62 | + ok = rabbit_ct_broker_helpers:rpc(Config, 0, |
| 63 | + ?MODULE, memory_breakdown_non_negative1, []). |
| 64 | + |
| 65 | +memory_breakdown_non_negative1() -> |
| 66 | + Memory = rabbit_vm:memory(), |
| 67 | + Keys = [other_proc, other_ets, other_system], |
| 68 | + lists:foreach( |
| 69 | + fun(Key) -> |
| 70 | + Value = proplists:get_value(Key, Memory), |
| 71 | + ?assert(is_integer(Value)), |
| 72 | + ?assert(Value >= 0) |
| 73 | + end, Keys), |
| 74 | + ok. |
0 commit comments