chore(mgmt): fix test case failure caused by slow kick

This commit is contained in:
zhanghongtong 2021-04-06 15:12:33 +08:00 committed by Rory Z
parent cff21ba16e
commit 0015520a6a
1 changed files with 4 additions and 1 deletions

View File

@ -218,6 +218,7 @@ clients(_) ->
{ok, _} = emqtt:connect(C1),
{ok, C2} = emqtt:start_link(#{username => Username2, clientid => ClientId2}),
{ok, _} = emqtt:connect(C2),
timer:sleep(300),
{ok, Clients1} = request_api(get, api_path(["clients", binary_to_list(ClientId1)])
@ -238,7 +239,7 @@ clients(_) ->
"clients",
"username", binary_to_list(Username2)])
, auth_header_()),
?assertEqual(<<"client2">>, maps:get(<<"clientid">>, lists:nth(1, get(<<"data">>, Clients4)))),
?assertEqual(<<"client2">>, maps:get(<<"clientid">>, lists:nth(1, get(<<"data">>, Clients4)))),
{ok, Clients5} = request_api(get, api_path(["clients"]), "_limit=100&_page=1", auth_header_()),
?assertEqual(2, maps:get(<<"count">>, get(<<"meta">>, Clients5))),
@ -262,6 +263,8 @@ clients(_) ->
{ok, Ok} = request_api(delete, api_path(["clients", binary_to_list(ClientId1)]), auth_header_()),
?assertEqual(?SUCCESS, get(<<"code">>, Ok)),
timer:sleep(300),
{ok, NotFound0} = request_api(delete, api_path(["clients", binary_to_list(ClientId1)]), auth_header_()),
?assertEqual(?ERROR12, get(<<"code">>, NotFound0)),