Просмотр исходного кода

Merge pull request #10068 from thalesmg/fix-flaky-mqtt-bridge-test

test: fix flaky mqtt bridge test
Thales Macedo Garitezi 3 лет назад
Родитель
Сommit
2fa4e8e21a
1 измененных файлов с 14 добавлено и 6 удалено
  1. 14 6
      apps/emqx_bridge/test/emqx_bridge_mqtt_SUITE.erl

+ 14 - 6
apps/emqx_bridge/test/emqx_bridge_mqtt_SUITE.erl

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