@@ -57,6 +57,7 @@ groups() ->
57
57
]},
58
58
runtime_parameters ,
59
59
set_disk_free_limit_command ,
60
+ set_vm_memory_high_watermark_command ,
60
61
topic_matching ,
61
62
user_management
62
63
]}
@@ -1505,22 +1506,41 @@ set_disk_free_limit_command1(_Config) ->
1505
1506
% % Use an integer
1506
1507
ok = control_action (set_disk_free_limit ,
1507
1508
[" mem_relative" , " 1" ]),
1508
- check_limit (1 ),
1509
+ disk_free_limit_to_total_memory_ratio_is (1 ),
1509
1510
1510
1511
% % Use a float
1511
1512
ok = control_action (set_disk_free_limit ,
1512
1513
[" mem_relative" , " 1.5" ]),
1513
- check_limit (1.5 ),
1514
+ disk_free_limit_to_total_memory_ratio_is (1.5 ),
1514
1515
1515
1516
ok = control_action (set_disk_free_limit , [" 50MB" ]),
1516
1517
passed .
1517
1518
1518
- check_limit ( Limit ) ->
1519
- ExpectedLimit = Limit * vm_memory_monitor :get_total_memory (),
1519
+ disk_free_limit_to_total_memory_ratio_is ( MemRatio ) ->
1520
+ ExpectedLimit = MemRatio * vm_memory_monitor :get_total_memory (),
1520
1521
% Total memory is unstable, so checking order
1521
1522
true = ExpectedLimit / rabbit_disk_monitor :get_disk_free_limit () < 1.2 ,
1522
1523
true = ExpectedLimit / rabbit_disk_monitor :get_disk_free_limit () > 0.98 .
1523
1524
1525
+ set_vm_memory_high_watermark_command (Config ) ->
1526
+ rabbit_ct_broker_helpers :rpc (Config , 0 ,
1527
+ ? MODULE , set_vm_memory_high_watermark_command1 , [Config ]).
1528
+
1529
+ set_vm_memory_high_watermark_command1 (_Config ) ->
1530
+ MemLimitRatio = " 1.0" ,
1531
+ MemTotal = vm_memory_monitor :get_total_memory (),
1532
+
1533
+ ok = control_action (set_vm_memory_high_watermark , [MemLimitRatio ]),
1534
+ MemLimit = vm_memory_monitor :get_memory_limit (),
1535
+ case MemLimit of
1536
+ MemTotal -> ok ;
1537
+ _ -> MemTotalToMemLimitRatio = MemLimit * 100.0 / MemTotal / 100 ,
1538
+ ct :fail (
1539
+ " Expected memory high watermark to be ~p (~s ), but it was ~p (~.1f )" ,
1540
+ [MemTotal , MemLimitRatio , MemLimit , MemTotalToMemLimitRatio ]
1541
+ )
1542
+ end .
1543
+
1524
1544
% % ---------------------------------------------------------------------------
1525
1545
% % rabbitmqctl helpers.
1526
1546
% % ---------------------------------------------------------------------------
0 commit comments