test(takeover): add back the delay when takeover
This commit is contained in:
parent
6243cf0b0c
commit
b76c701b1c
|
@ -76,6 +76,14 @@ t_takeover(Config) ->
|
||||||
Client1Msgs = messages(ClientId, 0, Middle),
|
Client1Msgs = messages(ClientId, 0, Middle),
|
||||||
Client2Msgs = messages(ClientId, Middle, ?CNT div 2),
|
Client2Msgs = messages(ClientId, Middle, ?CNT div 2),
|
||||||
AllMsgs = Client1Msgs ++ Client2Msgs,
|
AllMsgs = Client1Msgs ++ Client2Msgs,
|
||||||
|
meck:new(emqx_cm, [non_strict, passthrough]),
|
||||||
|
meck:expect(emqx_cm, takeover_session_end, fun(Arg) ->
|
||||||
|
%% trigger more complex takeover conditions during 2-phase takeover protocol:
|
||||||
|
%% when messages are accumulated in 2 processes simultaneously,
|
||||||
|
%% and need to be properly ordered / deduplicated after the protocol commences.
|
||||||
|
ok = timer:sleep(?SLEEP * 2),
|
||||||
|
meck:passthrough([Arg])
|
||||||
|
end),
|
||||||
Commands =
|
Commands =
|
||||||
[{fun start_client/5, [ClientId, ClientId, ?QOS_1, ClientOpts]}] ++
|
[{fun start_client/5, [ClientId, ClientId, ?QOS_1, ClientOpts]}] ++
|
||||||
[{fun publish_msg/2, [Msg]} || Msg <- Client1Msgs] ++
|
[{fun publish_msg/2, [Msg]} || Msg <- Client1Msgs] ++
|
||||||
|
@ -101,6 +109,7 @@ t_takeover(Config) ->
|
||||||
ct:pal("received: ~p", [[P || #{payload := P} <- Received]]),
|
ct:pal("received: ~p", [[P || #{payload := P} <- Received]]),
|
||||||
assert_messages_missed(AllMsgs, Received),
|
assert_messages_missed(AllMsgs, Received),
|
||||||
assert_messages_order(AllMsgs, Received),
|
assert_messages_order(AllMsgs, Received),
|
||||||
|
meck:unload(emqx_cm),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
t_takeover_willmsg(Config) ->
|
t_takeover_willmsg(Config) ->
|
||||||
|
|
Loading…
Reference in New Issue