summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Lazu <gerhard@lazu.co.uk>2017-07-10 17:00:11 +0100
committerGerhard Lazu <gerhard@lazu.co.uk>2017-07-10 17:00:11 +0100
commit8335658c358b56a40c91c64ea18f8a81c52c5c1e (patch)
tree426fd7c80630b64f81981b13275f22c5b15cae85
parent39c1bd19965dc31688413afad8cb13c454346a57 (diff)
downloadrabbitmq-server-git-8335658c358b56a40c91c64ea18f8a81c52c5c1e.tar.gz
Add test for set_vm_memory_high_watermark
This is meant to add a missing integration test that wraps up #1285 It's not a unit test and it can't run in paralle, but set_disk_free_limit does the same wrong thing. We should either remove them both or leave them as they are. [#148470947]
-rw-r--r--test/unit_inbroker_parallel_SUITE.erl28
1 files changed, 24 insertions, 4 deletions
diff --git a/test/unit_inbroker_parallel_SUITE.erl b/test/unit_inbroker_parallel_SUITE.erl
index d445d25efd..83b9d269c1 100644
--- a/test/unit_inbroker_parallel_SUITE.erl
+++ b/test/unit_inbroker_parallel_SUITE.erl
@@ -57,6 +57,7 @@ groups() ->
]},
runtime_parameters,
set_disk_free_limit_command,
+ set_vm_memory_high_watermark_command,
topic_matching,
user_management
]}
@@ -1505,22 +1506,41 @@ set_disk_free_limit_command1(_Config) ->
%% Use an integer
ok = control_action(set_disk_free_limit,
["mem_relative", "1"]),
- check_limit(1),
+ disk_free_limit_to_total_memory_ratio_is(1),
%% Use a float
ok = control_action(set_disk_free_limit,
["mem_relative", "1.5"]),
- check_limit(1.5),
+ disk_free_limit_to_total_memory_ratio_is(1.5),
ok = control_action(set_disk_free_limit, ["50MB"]),
passed.
-check_limit(Limit) ->
- ExpectedLimit = Limit * vm_memory_monitor:get_total_memory(),
+disk_free_limit_to_total_memory_ratio_is(MemRatio) ->
+ ExpectedLimit = MemRatio * vm_memory_monitor:get_total_memory(),
% Total memory is unstable, so checking order
true = ExpectedLimit/rabbit_disk_monitor:get_disk_free_limit() < 1.2,
true = ExpectedLimit/rabbit_disk_monitor:get_disk_free_limit() > 0.98.
+set_vm_memory_high_watermark_command(Config) ->
+ rabbit_ct_broker_helpers:rpc(Config, 0,
+ ?MODULE, set_vm_memory_high_watermark_command1, [Config]).
+
+set_vm_memory_high_watermark_command1(_Config) ->
+ MemLimitRatio = "1.0",
+ MemTotal = vm_memory_monitor:get_total_memory(),
+
+ ok = control_action(set_vm_memory_high_watermark, [MemLimitRatio]),
+ MemLimit = vm_memory_monitor:get_memory_limit(),
+ case MemLimit of
+ MemTotal -> ok;
+ _ -> MemTotalToMemLimitRatio = MemLimit * 100.0 / MemTotal / 100,
+ ct:fail(
+ "Expected memory high watermark to be ~p (~s), but it was ~p (~.1f)",
+ [MemTotal, MemLimitRatio, MemLimit, MemTotalToMemLimitRatio]
+ )
+ end.
+
%% ---------------------------------------------------------------------------
%% rabbitmqctl helpers.
%% ---------------------------------------------------------------------------