mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix tests for OTP-25+
This commit is contained in:
parent
30ee75cea1
commit
b9d4e05be0
4 changed files with 62 additions and 32 deletions
|
@ -109,7 +109,8 @@ bad_system_from_h1(Config) ->
|
|||
bad_system_from_h2(Config) ->
|
||||
doc("h2: Sending a system message with a bad From value results in a process crash."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
%% Skip the SETTINGS frame.
|
||||
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
|
||||
timer:sleep(100),
|
||||
|
@ -176,7 +177,8 @@ bad_system_message_h1(Config) ->
|
|||
bad_system_message_h2(Config) ->
|
||||
doc("h2: Sending a system message with a bad Request value results in an error."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
%% Skip the SETTINGS frame.
|
||||
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
|
||||
timer:sleep(100),
|
||||
|
@ -252,7 +254,8 @@ good_system_message_h1(Config) ->
|
|||
good_system_message_h2(Config) ->
|
||||
doc("h2: System messages are handled properly."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
%% Skip the SETTINGS frame.
|
||||
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
|
||||
timer:sleep(100),
|
||||
|
@ -336,7 +339,8 @@ trap_exit_parent_exit_h2(Config) ->
|
|||
doc("h2: A process trapping exits must stop when receiving "
|
||||
"an 'EXIT' message from its parent."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
%% Skip the SETTINGS frame.
|
||||
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
|
||||
timer:sleep(100),
|
||||
|
@ -408,7 +412,8 @@ trap_exit_other_exit_h2(Config) ->
|
|||
doc("h2: A process trapping exits must ignore "
|
||||
"'EXIT' messages from unknown processes."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
do_http2_handshake(Socket),
|
||||
Pid = get_remote_pid_tls(Socket),
|
||||
Pid ! {'EXIT', self(), {shutdown, ?MODULE}},
|
||||
|
@ -526,7 +531,8 @@ sys_change_code_h1(Config) ->
|
|||
sys_change_code_h2(Config) ->
|
||||
doc("h2: The sys:change_code/4 function works as expected."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
do_http2_handshake(Socket),
|
||||
Pid = get_remote_pid_tls(Socket),
|
||||
%% Suspend the process and try to get a request in. The
|
||||
|
@ -609,7 +615,8 @@ sys_get_state_h1(Config) ->
|
|||
sys_get_state_h2(Config) ->
|
||||
doc("h2: The sys:get_state/1 function works as expected."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
%% Skip the SETTINGS frame.
|
||||
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
|
||||
timer:sleep(100),
|
||||
|
@ -671,7 +678,8 @@ sys_get_status_h1(Config) ->
|
|||
sys_get_status_h2(Config) ->
|
||||
doc("h2: The sys:get_status/1 function works as expected."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
%% Skip the SETTINGS frame.
|
||||
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
|
||||
timer:sleep(100),
|
||||
|
@ -732,7 +740,8 @@ sys_replace_state_h1(Config) ->
|
|||
sys_replace_state_h2(Config) ->
|
||||
doc("h2: The sys:replace_state/2 function works as expected."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
%% Skip the SETTINGS frame.
|
||||
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
|
||||
timer:sleep(100),
|
||||
|
@ -801,7 +810,8 @@ sys_suspend_and_resume_h1(Config) ->
|
|||
sys_suspend_and_resume_h2(Config) ->
|
||||
doc("h2: The sys:suspend/1 and sys:resume/1 functions work as expected."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
do_http2_handshake(Socket),
|
||||
Pid = get_remote_pid_tls(Socket),
|
||||
%% Suspend the process and try to get a request in. The
|
||||
|
@ -880,7 +890,8 @@ sys_terminate_h1(Config) ->
|
|||
sys_terminate_h2(Config) ->
|
||||
doc("h2: The sys:terminate/2,3 function works as expected."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
%% Skip the SETTINGS frame.
|
||||
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
|
||||
timer:sleep(100),
|
||||
|
@ -983,7 +994,8 @@ supervisor_count_children_h1(Config) ->
|
|||
supervisor_count_children_h2(Config) ->
|
||||
doc("h2: The function supervisor:count_children/1 must work."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
do_http2_handshake(Socket),
|
||||
Pid = get_remote_pid_tls(Socket),
|
||||
%% No request was sent so there's no children.
|
||||
|
@ -1055,7 +1067,8 @@ supervisor_delete_child_not_found_h1(Config) ->
|
|||
supervisor_delete_child_not_found_h2(Config) ->
|
||||
doc("h2: The function supervisor:delete_child/2 must return {error, not_found}."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
do_http2_handshake(Socket),
|
||||
Pid = get_remote_pid_tls(Socket),
|
||||
%% When no children exist.
|
||||
|
@ -1114,7 +1127,8 @@ supervisor_get_childspec_not_found_h1(Config) ->
|
|||
supervisor_get_childspec_not_found_h2(Config) ->
|
||||
doc("h2: The function supervisor:get_childspec/2 must return {error, not_found}."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
do_http2_handshake(Socket),
|
||||
Pid = get_remote_pid_tls(Socket),
|
||||
%% When no children exist.
|
||||
|
@ -1173,7 +1187,8 @@ supervisor_restart_child_not_found_h1(Config) ->
|
|||
supervisor_restart_child_not_found_h2(Config) ->
|
||||
doc("h2: The function supervisor:restart_child/2 must return {error, not_found}."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
do_http2_handshake(Socket),
|
||||
Pid = get_remote_pid_tls(Socket),
|
||||
%% When no children exist.
|
||||
|
@ -1227,7 +1242,8 @@ supervisor_start_child_not_found_h1(Config) ->
|
|||
supervisor_start_child_not_found_h2(Config) ->
|
||||
doc("h2: The function supervisor:start_child/2 must return {error, start_child_disabled}."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
do_http2_handshake(Socket),
|
||||
Pid = get_remote_pid_tls(Socket),
|
||||
{error, start_child_disabled} = supervisor:start_child(Pid, #{
|
||||
|
@ -1281,7 +1297,8 @@ supervisor_terminate_child_not_found_h1(Config) ->
|
|||
supervisor_terminate_child_not_found_h2(Config) ->
|
||||
doc("h2: The function supervisor:terminate_child/2 must return {error, not_found}."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
do_http2_handshake(Socket),
|
||||
Pid = get_remote_pid_tls(Socket),
|
||||
%% When no children exist.
|
||||
|
@ -1344,7 +1361,8 @@ supervisor_which_children_h1(Config) ->
|
|||
supervisor_which_children_h2(Config) ->
|
||||
doc("h2: The function supervisor:which_children/1 must work."),
|
||||
{ok, Socket} = ssl:connect("localhost", config(tls_port, Config),
|
||||
[{active, false}, binary, {alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
[{active, false}, binary, {versions, ['tlsv1.2']},
|
||||
{alpn_advertised_protocols, [<<"h2">>]}]),
|
||||
do_http2_handshake(Socket),
|
||||
Pid = get_remote_pid_tls(Socket),
|
||||
%% No request was sent so there's no children.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue