Prechádzať zdrojové kódy

fix: test suite stable (#6136)

* fix: test suite stable
DDDHuang 4 rokov pred
rodič
commit
f0107868d4

+ 2 - 0
apps/emqx/test/emqx_broker_SUITE.erl

@@ -345,11 +345,13 @@ t_connected_client_count_persistent(Config) when is_list(Config) ->
                              fun() -> emqtt:ConnFun(ConnPid0) end,
                              [emqx_cm_connected_client_count_inc]
                             ),
+    timer:sleep(10),
     ?assertEqual(1, emqx_cm:get_connected_client_count()),
     {ok, {ok, [_]}} = wait_for_events(
                         fun() -> emqtt:disconnect(ConnPid0) end,
                         [emqx_cm_connected_client_count_dec]
                        ),
+    timer:sleep(10),
     ?assertEqual(0, emqx_cm:get_connected_client_count()),
     %% reconnecting
     {ok, ConnPid1} = emqtt:start_link([ {clean_start, false}

+ 4 - 2
apps/emqx/test/emqx_persistent_session_SUITE.erl

@@ -413,6 +413,7 @@ t_persist_on_disconnect(Config) ->
                                        {properties, #{'Session-Expiry-Interval' => 30}}
                                      | Config]),
     {ok, _} = emqtt:ConnFun(Client2),
+    timer:sleep(10),
     %% The session should not be known, since it wasn't persisted because of the
     %% changed expiry interval in the disconnect call.
     ?assertEqual(0, client_info(session_present, Client2)),
@@ -492,7 +493,8 @@ t_process_dies_session_expires(Config) ->
             %% The session should be a fresh one
             {persistent, NewSession} = emqx_persistent_session:lookup(ClientId),
             ?assertNotEqual(SessionId, emqx_session:info(id, NewSession)),
-            %% The old session should now either be marked as abandoned or already be garbage collected.
+            %% The old session should now either
+            %% be marked as abandoned or already be garbage collected.
             ?assertMatch([], emqx_persistent_session:pending(SessionId));
         false ->
             skip
@@ -862,7 +864,7 @@ t_snabbkaffe_buffered_messages(Config) ->
            ?force_ordering( #{ ?snk_kind := ps_worker_deliver },
                             #{ ?snk_kind := ps_resume_end }),
            spawn_link(fun() ->
-                              ?block_until(#{ ?snk_kind := ps_marker_pendings_msgs }, infinity, 5000),
+                              ?block_until(#{?snk_kind := ps_marker_pendings_msgs}, infinity, 5000),
                               publish(Topic, Payloads2)
                       end),
            {ok, Client2} = emqtt:start_link([{clean_start, false} | EmqttOpts]),