From d143c3677c9fa93fa2fde648c878faccae12520a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 22 Sep 2019 21:03:27 +0200 Subject: Account for Windows' 3-connect pattern in shutdown_SUITE When Windows can't connect it retries 2 more times with 500ms wait in-between by default. --- test/shutdown_SUITE.erl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/shutdown_SUITE.erl b/test/shutdown_SUITE.erl index 173fd50..4cc2566 100644 --- a/test/shutdown_SUITE.erl +++ b/test/shutdown_SUITE.erl @@ -60,7 +60,11 @@ not_connected_gun_shutdown(_) -> {ok, ConnPid} = gun:open("localhost", 12345), ConnRef = monitor(process, ConnPid), gun:shutdown(ConnPid), - gun_is_down(ConnPid, ConnRef, shutdown). + Timeout = case os:type() of + {win32, _} -> 2000; + _ -> 1000 + end, + gun_is_down(ConnPid, ConnRef, shutdown, Timeout). not_connected_owner_down(_) -> doc("Confirm that the Gun process shuts down when the owner exits normally " @@ -82,7 +86,11 @@ do_not_connected_owner_down(ExitReason, DownReason) -> end), ConnPid = receive {conn, C} -> C after 1000 -> error(timeout) end, ConnRef = monitor(process, ConnPid), - gun_is_down(ConnPid, ConnRef, DownReason). + Timeout = case os:type() of + {win32, _} -> 2000; + _ -> 1000 + end, + gun_is_down(ConnPid, ConnRef, DownReason, Timeout). http1_gun_shutdown_no_streams(Config) -> doc("HTTP/1.1: Confirm that the Gun process shuts down gracefully " @@ -592,11 +600,14 @@ do_closing_owner_down(Config, ExitReason, DownReason) -> %% Internal. gun_is_down(ConnPid, ConnRef, Expected) -> + gun_is_down(ConnPid, ConnRef, Expected, 1000). + +gun_is_down(ConnPid, ConnRef, Expected, Timeout) -> receive {'DOWN', ConnRef, process, ConnPid, Reason} -> Expected = Reason, ok - after 1000 -> + after Timeout -> true = erlang:is_process_alive(ConnPid), error(timeout) end. -- cgit v1.2.3