test(emqx_bridge_mqtt): fix race condition
This commit is contained in:
parent
186dfd04a7
commit
2ffa71abde
|
@ -27,7 +27,8 @@
|
|||
-type ack_ref() :: emqx_bridge_worker:ack_ref().
|
||||
-type batch() :: emqx_bridge_worker:batch().
|
||||
|
||||
start(Cfg) ->
|
||||
start(#{client_pid := Pid} = Cfg) ->
|
||||
Pid ! {self(), ?MODULE, ready},
|
||||
{ok, Cfg}.
|
||||
|
||||
stop(_) -> ok.
|
||||
|
|
|
@ -194,6 +194,12 @@ t_stub_normal(Config) when is_list(Config) ->
|
|||
client_pid => self()
|
||||
},
|
||||
{ok, Pid} = emqx_bridge_worker:start_link(?FUNCTION_NAME, Cfg),
|
||||
receive
|
||||
{Pid, emqx_bridge_stub_conn, ready} -> ok
|
||||
after
|
||||
5000 ->
|
||||
error(timeout)
|
||||
end,
|
||||
ClientId = <<"ClientId">>,
|
||||
try
|
||||
{ok, ConnPid} = emqtt:start_link([{clientid, ClientId}]),
|
||||
|
@ -203,6 +209,9 @@ t_stub_normal(Config) when is_list(Config) ->
|
|||
{stub_message, WorkerPid, BatchRef, _Batch} ->
|
||||
WorkerPid ! {batch_ack, BatchRef},
|
||||
ok
|
||||
after
|
||||
5000 ->
|
||||
error(timeout)
|
||||
end,
|
||||
?SNK_WAIT(inflight_drained),
|
||||
?SNK_WAIT(replayq_drained),
|
||||
|
|
Loading…
Reference in New Issue