aboutsummaryrefslogtreecommitdiffstats
path: root/test/sys_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/sys_SUITE.erl')
-rw-r--r--test/sys_SUITE.erl61
1 files changed, 39 insertions, 22 deletions
diff --git a/test/sys_SUITE.erl b/test/sys_SUITE.erl
index 175219c..2feb716 100644
--- a/test/sys_SUITE.erl
+++ b/test/sys_SUITE.erl
@@ -1,4 +1,4 @@
-%% Copyright (c) 2018, Loïc Hoguin <[email protected]>
+%% Copyright (c) 2018-2024, Loïc Hoguin <[email protected]>
%%
%% Permission to use, copy, modify, and/or distribute this software for any
%% purpose with or without fee is hereby granted, provided that the above
@@ -22,7 +22,6 @@
-import(ct_helper, [get_remote_pid_tcp/1]).
-import(ct_helper, [get_remote_pid_tls/1]).
-import(ct_helper, [is_process_down/1]).
--import(cowboy_test, [gun_open/1]).
all() ->
[{group, sys}].
@@ -109,7 +108,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
%% Skip the SETTINGS frame.
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
timer:sleep(100),
@@ -176,7 +176,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
%% Skip the SETTINGS frame.
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
timer:sleep(100),
@@ -252,7 +253,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
%% Skip the SETTINGS frame.
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
timer:sleep(100),
@@ -336,7 +338,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
%% Skip the SETTINGS frame.
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
timer:sleep(100),
@@ -408,7 +411,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
do_http2_handshake(Socket),
Pid = get_remote_pid_tls(Socket),
Pid ! {'EXIT', self(), {shutdown, ?MODULE}},
@@ -526,7 +530,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
do_http2_handshake(Socket),
Pid = get_remote_pid_tls(Socket),
%% Suspend the process and try to get a request in. The
@@ -609,7 +614,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
%% Skip the SETTINGS frame.
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
timer:sleep(100),
@@ -653,7 +659,7 @@ sys_get_state_loop(Config) ->
timer:sleep(100),
SupPid = get_remote_pid_tcp(Socket),
[{_, Pid, _, _}] = supervisor:which_children(SupPid),
- {Req, Env, long_polling_sys_h, undefined} = sys:get_state(Pid),
+ {Req, Env, long_polling_sys_h, undefined, infinity} = sys:get_state(Pid),
#{pid := _, streamid := _} = Req,
#{dispatch := _} = Env,
ok.
@@ -671,7 +677,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
%% Skip the SETTINGS frame.
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
timer:sleep(100),
@@ -732,7 +739,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
%% Skip the SETTINGS frame.
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
timer:sleep(100),
@@ -776,7 +784,7 @@ sys_replace_state_loop(Config) ->
timer:sleep(100),
SupPid = get_remote_pid_tcp(Socket),
[{_, Pid, _, _}] = supervisor:which_children(SupPid),
- {Req, Env, long_polling_sys_h, undefined} = sys:replace_state(Pid, fun(S) -> S end),
+ {Req, Env, long_polling_sys_h, undefined, infinity} = sys:replace_state(Pid, fun(S) -> S end),
#{pid := _, streamid := _} = Req,
#{dispatch := _} = Env,
ok.
@@ -801,7 +809,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
do_http2_handshake(Socket),
Pid = get_remote_pid_tls(Socket),
%% Suspend the process and try to get a request in. The
@@ -880,7 +889,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
%% Skip the SETTINGS frame.
{ok, <<_,_,_,4,_/bits>>} = ssl:recv(Socket, 0, 1000),
timer:sleep(100),
@@ -983,7 +993,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
do_http2_handshake(Socket),
Pid = get_remote_pid_tls(Socket),
%% No request was sent so there's no children.
@@ -1055,7 +1066,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
do_http2_handshake(Socket),
Pid = get_remote_pid_tls(Socket),
%% When no children exist.
@@ -1114,7 +1126,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
do_http2_handshake(Socket),
Pid = get_remote_pid_tls(Socket),
%% When no children exist.
@@ -1173,7 +1186,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
do_http2_handshake(Socket),
Pid = get_remote_pid_tls(Socket),
%% When no children exist.
@@ -1227,7 +1241,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
do_http2_handshake(Socket),
Pid = get_remote_pid_tls(Socket),
{error, start_child_disabled} = supervisor:start_child(Pid, #{
@@ -1281,7 +1296,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
do_http2_handshake(Socket),
Pid = get_remote_pid_tls(Socket),
%% When no children exist.
@@ -1344,7 +1360,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">>]}]),
+ [{alpn_advertised_protocols, [<<"h2">>]},
+ {active, false}, binary|config(tls_opts, Config)]),
do_http2_handshake(Socket),
Pid = get_remote_pid_tls(Socket),
%% No request was sent so there's no children.