From 8dc712543e4c544aad3b72aab8a94aeab05e3dae Mon Sep 17 00:00:00 2001 From: Diana Parra Corbacho Date: Tue, 5 Nov 2024 12:37:10 +0100 Subject: [PATCH 1/2] Tests: set disk monitor as active in set_disk_free_limit_command_test --- .../ctl/set_disk_free_limit_command_test.exs | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/deps/rabbitmq_cli/test/ctl/set_disk_free_limit_command_test.exs b/deps/rabbitmq_cli/test/ctl/set_disk_free_limit_command_test.exs index b1157b6eee2d..a98de49f092e 100644 --- a/deps/rabbitmq_cli/test/ctl/set_disk_free_limit_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/set_disk_free_limit_command_test.exs @@ -26,6 +26,12 @@ defmodule SetDiskFreeLimitCommandTest do # silences warnings context[:tag] on_exit([], fn -> set_disk_free_limit(@default_limit) end) + :rabbit_misc.rpc_call( + get_rabbit_hostname(), + :rabbit_disk_monitor, + :set_enabled, + [:true] + ) {:ok, opts: %{node: get_rabbit_hostname()}} end @@ -104,8 +110,12 @@ defmodule SetDiskFreeLimitCommandTest do test "run: a valid integer input returns an ok and sets the disk free limit", context do set_disk_free_limit(@default_limit) assert @command.run([context[:limit]], context[:opts]) == :ok - Process.sleep(500) - assert status()[:disk_free_limit] === context[:limit] + await_condition( + fn -> + status()[:disk_free_limit] === context[:limit] + end, + 30000 + ) set_disk_free_limit(@default_limit) end @@ -115,8 +125,12 @@ defmodule SetDiskFreeLimitCommandTest do context do set_disk_free_limit(@default_limit) assert @command.run([context[:limit]], context[:opts]) == :ok - Process.sleep(500) - assert status()[:disk_free_limit] === round(context[:limit]) + await_condition( + fn -> + status()[:disk_free_limit] === round(context[:limit]) + end, + 30000 + ) set_disk_free_limit(@default_limit) end @@ -126,8 +140,12 @@ defmodule SetDiskFreeLimitCommandTest do context do set_disk_free_limit(@default_limit) assert @command.run([context[:limit]], context[:opts]) == :ok - Process.sleep(500) - assert status()[:disk_free_limit] === context[:limit] |> Float.floor() |> round + await_condition( + fn -> + status()[:disk_free_limit] === context[:limit] |> Float.floor() |> round + end, + 30000 + ) set_disk_free_limit(@default_limit) end @@ -136,8 +154,12 @@ defmodule SetDiskFreeLimitCommandTest do test "run: an integer string input returns an ok and sets the disk free limit", context do set_disk_free_limit(@default_limit) assert @command.run([context[:limit]], context[:opts]) == :ok - Process.sleep(500) - assert status()[:disk_free_limit] === String.to_integer(context[:limit]) + await_condition( + fn -> + status()[:disk_free_limit] === String.to_integer(context[:limit]) + end, + 30000 + ) set_disk_free_limit(@default_limit) end @@ -145,8 +167,12 @@ defmodule SetDiskFreeLimitCommandTest do @tag limit: "2MB" test "run: an valid unit string input returns an ok and changes the limit", context do assert @command.run([context[:limit]], context[:opts]) == :ok - Process.sleep(500) - assert status()[:disk_free_limit] === 2_000_000 + await_condition( + fn -> + status()[:disk_free_limit] === 2_000_000 + end, + 30000 + ) set_disk_free_limit(@default_limit) end From 3eb2bc45077d765c48ea471f9ecbc98b27645a84 Mon Sep 17 00:00:00 2001 From: Diana Parra Corbacho Date: Tue, 5 Nov 2024 16:13:43 +0100 Subject: [PATCH 2/2] Tests: clustering_prop_SUITE set core_metrics_gc_interval to a very low value --- deps/rabbitmq_management/test/clustering_prop_SUITE.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deps/rabbitmq_management/test/clustering_prop_SUITE.erl b/deps/rabbitmq_management/test/clustering_prop_SUITE.erl index a56832f898e9..613d84168e75 100644 --- a/deps/rabbitmq_management/test/clustering_prop_SUITE.erl +++ b/deps/rabbitmq_management/test/clustering_prop_SUITE.erl @@ -46,7 +46,8 @@ merge_app_env(Config) -> {rabbit, [ {collect_statistics, fine}, {collect_statistics_interval, - ?COLLECT_INTERVAL} + ?COLLECT_INTERVAL}, + {core_metrics_gc_interval, 1000} ]}), rabbit_ct_helpers:merge_app_env(Config1, {rabbitmq_management, [