test: fix flaky mqtt bridge test

Sometimes, this test fails because the metrics are still in the
inflight phase.
This commit is contained in:
Thales Macedo Garitezi 2023-03-03 17:51:48 -03:00
parent be3fd24019
commit 8fbb948b6f
1 changed files with 14 additions and 6 deletions

View File

@ -359,9 +359,13 @@ t_mqtt_conn_bridge_egress(_) ->
?assertMatch(<<ResourceID:Size/binary, _/binary>>, Msg#message.from), ?assertMatch(<<ResourceID:Size/binary, _/binary>>, Msg#message.from),
%% verify the metrics of the bridge %% verify the metrics of the bridge
?assertMetrics( ?retry(
#{<<"matched">> := 1, <<"success">> := 1, <<"failed">> := 0}, _Interval = 200,
BridgeIDEgress _Attempts = 5,
?assertMetrics(
#{<<"matched">> := 1, <<"success">> := 1, <<"failed">> := 0},
BridgeIDEgress
)
), ),
%% delete the bridge %% delete the bridge
@ -402,9 +406,13 @@ t_mqtt_conn_bridge_egress_no_payload_template(_) ->
?assertMatch(#{<<"payload">> := Payload}, jsx:decode(Msg#message.payload)), ?assertMatch(#{<<"payload">> := Payload}, jsx:decode(Msg#message.payload)),
%% verify the metrics of the bridge %% verify the metrics of the bridge
?assertMetrics( ?retry(
#{<<"matched">> := 1, <<"success">> := 1, <<"failed">> := 0}, _Interval = 200,
BridgeIDEgress _Attempts = 5,
?assertMetrics(
#{<<"matched">> := 1, <<"success">> := 1, <<"failed">> := 0},
BridgeIDEgress
)
), ),
%% delete the bridge %% delete the bridge