diff --git a/deps/rabbit/test/backing_queue_SUITE.erl b/deps/rabbit/test/backing_queue_SUITE.erl index 0efa3633189..152daf04308 100644 --- a/deps/rabbit/test/backing_queue_SUITE.erl +++ b/deps/rabbit/test/backing_queue_SUITE.erl @@ -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. + << < 254; _ -> B end>> || <> <= Bytes >>. gen_msg_file(Config, Blocks) -> PrivDir = ?config(priv_dir, Config), @@ -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), [<>, MsgId, Msg, <<255>>]