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

CQ: Fix flakes in the store file scan test (backport #12721) #12724

Merged
merged 1 commit into from
Nov 14, 2024
Merged
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
12 changes: 7 additions & 5 deletions deps/rabbit/test/backing_queue_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,11 @@ gen_msg() ->
gen_msg(1024 * 1024).

gen_msg(MaxSize) ->
%% This might generate false positives but very rarely
%% so we don't do anything to prevent them.
rand:bytes(rand:uniform(MaxSize)).
Bytes = rand:bytes(rand:uniform(MaxSize)),
%% We remove 255 to avoid false positives. In a running
%% rabbit node we will not get false positives because
%% we also check messages against the index.
<< <<case B of 255 -> 254; _ -> B end>> || <<B>> <= Bytes >>.

gen_msg_file(Config, Blocks) ->
PrivDir = ?config(priv_dir, Config),
Expand All @@ -667,8 +669,8 @@ gen_msg_file(Config, Blocks) ->
{bin, Bin} ->
Bin;
{pad, Size} ->
%% This might generate false positives although very unlikely.
rand:bytes(Size);
%% Empty space between messages is expected to be zeroes.
<<0:Size/unit:8>>;
{msg, MsgId, Msg} ->
Size = 16 + byte_size(Msg),
[<<Size:64>>, MsgId, Msg, <<255>>]
Expand Down
Loading