mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix TLS tests for OTP-26+
ct_helper now uses the test certificates generated by public_key. A few adjustments had to be made as a result.
This commit is contained in:
parent
251e70b219
commit
12108ab668
5 changed files with 70 additions and 60 deletions
|
@ -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,8 +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, {versions, ['tlsv1.2']},
|
||||
{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),
|
||||
|
@ -177,8 +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, {versions, ['tlsv1.2']},
|
||||
{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),
|
||||
|
@ -254,8 +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, {versions, ['tlsv1.2']},
|
||||
{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),
|
||||
|
@ -339,8 +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, {versions, ['tlsv1.2']},
|
||||
{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),
|
||||
|
@ -412,8 +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, {versions, ['tlsv1.2']},
|
||||
{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}},
|
||||
|
@ -531,8 +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, {versions, ['tlsv1.2']},
|
||||
{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
|
||||
|
@ -615,8 +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, {versions, ['tlsv1.2']},
|
||||
{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),
|
||||
|
@ -678,8 +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, {versions, ['tlsv1.2']},
|
||||
{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),
|
||||
|
@ -740,8 +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, {versions, ['tlsv1.2']},
|
||||
{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),
|
||||
|
@ -810,8 +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, {versions, ['tlsv1.2']},
|
||||
{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
|
||||
|
@ -890,8 +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, {versions, ['tlsv1.2']},
|
||||
{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),
|
||||
|
@ -994,8 +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, {versions, ['tlsv1.2']},
|
||||
{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.
|
||||
|
@ -1067,8 +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, {versions, ['tlsv1.2']},
|
||||
{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.
|
||||
|
@ -1127,8 +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, {versions, ['tlsv1.2']},
|
||||
{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.
|
||||
|
@ -1187,8 +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, {versions, ['tlsv1.2']},
|
||||
{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.
|
||||
|
@ -1242,8 +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, {versions, ['tlsv1.2']},
|
||||
{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, #{
|
||||
|
@ -1297,8 +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, {versions, ['tlsv1.2']},
|
||||
{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.
|
||||
|
@ -1361,8 +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, {versions, ['tlsv1.2']},
|
||||
{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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue