test(takeover): randomize messages for random natural ordering
This commit is contained in:
parent
f022c9b1a4
commit
04731b7ef7
|
@ -160,4 +160,15 @@ assert_messages_order([Msg | Ls1], [{publish, #{payload := No}} | Ls2]) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
messages(Cnt) ->
|
messages(Cnt) ->
|
||||||
[emqx_message:make(ct, 1, ?TOPIC, integer_to_binary(I)) || I <- lists:seq(1, Cnt)].
|
[emqx_message:make(ct, 1, ?TOPIC, payload(I)) || I <- lists:seq(1, Cnt)].
|
||||||
|
|
||||||
|
payload(I) ->
|
||||||
|
% NOTE
|
||||||
|
% Introduce randomness so that natural order is not the same as arrival order.
|
||||||
|
iolist_to_binary(
|
||||||
|
io_lib:format("~4.16.0B [~B] [~s]", [
|
||||||
|
rand:uniform(16#10000) - 1,
|
||||||
|
I,
|
||||||
|
emqx_utils_calendar:now_to_rfc3339(millisecond)
|
||||||
|
])
|
||||||
|
).
|
||||||
|
|
Loading…
Reference in New Issue