diff options
author | Loïc Hoguin <[email protected]> | 2019-09-22 21:03:27 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-09-22 21:04:22 +0200 |
commit | d143c3677c9fa93fa2fde648c878faccae12520a (patch) | |
tree | d034d352f01847e20000e1dc812000f7f13de170 /test | |
parent | ac224237921a271ae359f384329c3492c0801edc (diff) | |
download | gun-d143c3677c9fa93fa2fde648c878faccae12520a.tar.gz gun-d143c3677c9fa93fa2fde648c878faccae12520a.tar.bz2 gun-d143c3677c9fa93fa2fde648c878faccae12520a.zip |
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.
Diffstat (limited to 'test')
-rw-r--r-- | test/shutdown_SUITE.erl | 17 |
1 files 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. |