Merge pull request #9944 from keynslug/fix/mqtt-bridge-test-flap
test(mqtt-bridge): manage test flaps by waiting for flush events
This commit is contained in:
commit
373947a4b9
|
@ -317,10 +317,13 @@ t_mqtt_conn_bridge_egress(_) ->
|
||||||
RemoteTopic = <<?EGRESS_REMOTE_TOPIC, "/", LocalTopic/binary>>,
|
RemoteTopic = <<?EGRESS_REMOTE_TOPIC, "/", LocalTopic/binary>>,
|
||||||
Payload = <<"hello">>,
|
Payload = <<"hello">>,
|
||||||
emqx:subscribe(RemoteTopic),
|
emqx:subscribe(RemoteTopic),
|
||||||
timer:sleep(100),
|
|
||||||
%% PUBLISH a message to the 'local' broker, as we have only one broker,
|
?wait_async_action(
|
||||||
%% the remote broker is also the local one.
|
%% PUBLISH a message to the 'local' broker, as we have only one broker,
|
||||||
emqx:publish(emqx_message:make(LocalTopic, Payload)),
|
%% the remote broker is also the local one.
|
||||||
|
emqx:publish(emqx_message:make(LocalTopic, Payload)),
|
||||||
|
#{?snk_kind := buffer_worker_flush_ack}
|
||||||
|
),
|
||||||
|
|
||||||
%% we should receive a message on the "remote" broker, with specified topic
|
%% we should receive a message on the "remote" broker, with specified topic
|
||||||
Msg = assert_mqtt_msg_received(RemoteTopic, Payload),
|
Msg = assert_mqtt_msg_received(RemoteTopic, Payload),
|
||||||
|
@ -356,10 +359,13 @@ t_mqtt_conn_bridge_egress_no_payload_template(_) ->
|
||||||
RemoteTopic = <<?EGRESS_REMOTE_TOPIC, "/", LocalTopic/binary>>,
|
RemoteTopic = <<?EGRESS_REMOTE_TOPIC, "/", LocalTopic/binary>>,
|
||||||
Payload = <<"hello">>,
|
Payload = <<"hello">>,
|
||||||
emqx:subscribe(RemoteTopic),
|
emqx:subscribe(RemoteTopic),
|
||||||
timer:sleep(100),
|
|
||||||
%% PUBLISH a message to the 'local' broker, as we have only one broker,
|
?wait_async_action(
|
||||||
%% the remote broker is also the local one.
|
%% PUBLISH a message to the 'local' broker, as we have only one broker,
|
||||||
emqx:publish(emqx_message:make(LocalTopic, Payload)),
|
%% the remote broker is also the local one.
|
||||||
|
emqx:publish(emqx_message:make(LocalTopic, Payload)),
|
||||||
|
#{?snk_kind := buffer_worker_flush_ack}
|
||||||
|
),
|
||||||
|
|
||||||
%% we should receive a message on the "remote" broker, with specified topic
|
%% we should receive a message on the "remote" broker, with specified topic
|
||||||
Msg = assert_mqtt_msg_received(RemoteTopic),
|
Msg = assert_mqtt_msg_received(RemoteTopic),
|
||||||
|
@ -444,10 +450,13 @@ t_mqtt_conn_bridge_ingress_and_egress(_) ->
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
} = request_bridge_metrics(BridgeIDEgress),
|
} = request_bridge_metrics(BridgeIDEgress),
|
||||||
timer:sleep(100),
|
|
||||||
%% PUBLISH a message to the 'local' broker, as we have only one broker,
|
?wait_async_action(
|
||||||
%% the remote broker is also the local one.
|
%% PUBLISH a message to the 'local' broker, as we have only one broker,
|
||||||
emqx:publish(emqx_message:make(LocalTopic, Payload)),
|
%% the remote broker is also the local one.
|
||||||
|
emqx:publish(emqx_message:make(LocalTopic, Payload)),
|
||||||
|
#{?snk_kind := buffer_worker_flush_ack}
|
||||||
|
),
|
||||||
|
|
||||||
%% we should receive a message on the "remote" broker, with specified topic
|
%% we should receive a message on the "remote" broker, with specified topic
|
||||||
assert_mqtt_msg_received(RemoteTopic, Payload),
|
assert_mqtt_msg_received(RemoteTopic, Payload),
|
||||||
|
@ -677,10 +686,13 @@ t_mqtt_conn_bridge_egress_reconnect(_) ->
|
||||||
RemoteTopic = <<?EGRESS_REMOTE_TOPIC, "/", LocalTopic/binary>>,
|
RemoteTopic = <<?EGRESS_REMOTE_TOPIC, "/", LocalTopic/binary>>,
|
||||||
Payload0 = <<"hello">>,
|
Payload0 = <<"hello">>,
|
||||||
emqx:subscribe(RemoteTopic),
|
emqx:subscribe(RemoteTopic),
|
||||||
timer:sleep(100),
|
|
||||||
%% PUBLISH a message to the 'local' broker, as we have only one broker,
|
?wait_async_action(
|
||||||
%% the remote broker is also the local one.
|
%% PUBLISH a message to the 'local' broker, as we have only one broker,
|
||||||
emqx:publish(emqx_message:make(LocalTopic, Payload0)),
|
%% the remote broker is also the local one.
|
||||||
|
emqx:publish(emqx_message:make(LocalTopic, Payload0)),
|
||||||
|
#{?snk_kind := buffer_worker_flush_ack}
|
||||||
|
),
|
||||||
|
|
||||||
%% we should receive a message on the "remote" broker, with specified topic
|
%% we should receive a message on the "remote" broker, with specified topic
|
||||||
assert_mqtt_msg_received(RemoteTopic, Payload0),
|
assert_mqtt_msg_received(RemoteTopic, Payload0),
|
||||||
|
|
Loading…
Reference in New Issue