summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Klishin <michael@novemberain.com>2017-07-11 03:39:25 +0300
committerGitHub <noreply@github.com>2017-07-11 03:39:25 +0300
commit6967bb30cec8af59e76bcbe098dd0e959c09eacc (patch)
treef954e8ba0c1950d978a7b885836aaf838364ef32 /test
parent0872a15a050176ab7598bc3d1b21a2d5c5af3052 (diff)
parent8335658c358b56a40c91c64ea18f8a81c52c5c1e (diff)
downloadrabbitmq-server-git-6967bb30cec8af59e76bcbe098dd0e959c09eacc.tar.gz
Merge pull request #1290 from rabbitmq/rabbitmq-server-1285
Add test for set_vm_memory_high_watermark
Diffstat (limited to 'test')
-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.
%% ---------------------------------------------------------------------------