Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for test flakes (backport #12671) (backport #12672) #12676

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 36 additions & 10 deletions deps/rabbitmq_cli/test/ctl/set_disk_free_limit_command_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -136,17 +154,25 @@ 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

@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
Expand Down
6 changes: 5 additions & 1 deletion deps/rabbitmq_management/test/clustering_prop_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ groups() ->
]}
].

-define(COLLECT_INTERVAL, 500).

%% -------------------------------------------------------------------
%% Testsuite setup/teardown.
%% -------------------------------------------------------------------
Expand All @@ -42,7 +44,9 @@ merge_app_env(Config) ->
Config1 = rabbit_ct_helpers:merge_app_env(Config,
{rabbit, [
{collect_statistics, fine},
{collect_statistics_interval, 500}
{collect_statistics_interval,
?COLLECT_INTERVAL},
{core_metrics_gc_interval, 1000}
]}),
rabbit_ct_helpers:merge_app_env(Config1,
{rabbitmq_management, [
Expand Down
Loading