From 5df80fa8199e9e3807c7799c08b7ceb6831cf267 Mon Sep 17 00:00:00 2001 From: William Yang Date: Wed, 23 Oct 2024 18:58:28 +0200 Subject: [PATCH] test: add tc_shutdown_conn_before_handshake --- test/quicer_connection_SUITE.erl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/quicer_connection_SUITE.erl b/test/quicer_connection_SUITE.erl index 5c70448e..74ef0de4 100644 --- a/test/quicer_connection_SUITE.erl +++ b/test/quicer_connection_SUITE.erl @@ -897,6 +897,25 @@ tc_get_conn_owner_server(Config) -> ct:fail({client_fail, Reason}) end. +tc_shutdown_conn_before_handshake(Config) -> + Port = select_port(), + {ok, L} = quicer:listen(Port, default_listen_opts(Config)), + {ok, L} = quicer:async_accept(L, #{}), + CPid = spawn(fun() -> + _ = quicer:connect("localhost", Port, default_conn_opts(), 1000), + receive + done -> ok + end + end), + receive + {quic, new_conn, Conn, _} -> + Res = quicer:shutdown_connection(Conn), + CPid ! done, + ?assertEqual(ok, Res) + after 1000 -> + ct:fail("conn from client timeout") + end. + %%% %%% Helpers %%%