aboutsummaryrefslogtreecommitdiffstats
path: root/test/rfc7540_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-19 09:05:34 +0100
committerLoïc Hoguin <[email protected]>2018-11-19 09:05:34 +0100
commitbed328b6c9ce41782c340a89554599a838574d82 (patch)
tree065bd9faad0b6abe234302b599624fe6981fad5d /test/rfc7540_SUITE.erl
parent6cc3b0ccca6c06592c2a1881cae39945de805747 (diff)
downloadcowboy-bed328b6c9ce41782c340a89554599a838574d82.tar.gz
cowboy-bed328b6c9ce41782c340a89554599a838574d82.tar.bz2
cowboy-bed328b6c9ce41782c340a89554599a838574d82.zip
Use ?FUNCTION_NAME instead of ct_helper:name()
Cowboy is 19+ so it's OK to use it.
Diffstat (limited to 'test/rfc7540_SUITE.erl')
-rw-r--r--test/rfc7540_SUITE.erl45
1 files changed, 22 insertions, 23 deletions
diff --git a/test/rfc7540_SUITE.erl b/test/rfc7540_SUITE.erl
index 4708f06..2f20a59 100644
--- a/test/rfc7540_SUITE.erl
+++ b/test/rfc7540_SUITE.erl
@@ -18,7 +18,6 @@
-import(ct_helper, [config/2]).
-import(ct_helper, [doc/1]).
--import(ct_helper, [name/0]).
-import(cowboy_test, [gun_open/1]).
-import(cowboy_test, [raw_open/1]).
-import(cowboy_test, [raw_send/2]).
@@ -1324,7 +1323,7 @@ max_frame_size_allow_exactly_custom(Config0) ->
doc("An endpoint that sets SETTINGS_MAX_FRAME_SIZE must allow frames "
"of up to that size. (RFC7540 4.2, RFC7540 6.5.2)"),
%% Create a new listener that sets the maximum frame size to 30000.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
max_frame_size_received => 30000
}, Config0),
@@ -1348,13 +1347,13 @@ max_frame_size_allow_exactly_custom(Config0) ->
{ok, _} = gen_tcp:recv(Socket, Len2, 6000),
%% No errors follow due to our sending of a 25000 bytes frame.
{error, timeout} = gen_tcp:recv(Socket, 0, 1000),
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
max_frame_size_reject_larger_than_custom(Config0) ->
doc("An endpoint that sets SETTINGS_MAX_FRAME_SIZE must reject frames "
"of up to that size with a FRAME_SIZE_ERROR connection error. (RFC7540 4.2, RFC7540 6.5.2)"),
%% Create a new listener that sets the maximum frame size to 30000.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
max_frame_size_received => 30000
}, Config0),
@@ -1375,7 +1374,7 @@ max_frame_size_reject_larger_than_custom(Config0) ->
]),
%% Receive a FRAME_SIZE_ERROR connection error.
{ok, << _:24, 7:8, _:72, 6:32 >>} = gen_tcp:recv(Socket, 17, 6000),
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
%% I am using FRAME_SIZE_ERROR here because the information in the
%% frame header tells us this frame is at least 1 byte long, while
@@ -2552,7 +2551,7 @@ settings_header_table_size_server(Config0) ->
"used by the server to decode header blocks. (RFC7540 6.5.2)"),
HeaderTableSize = 128,
%% Create a new listener that allows larger header table sizes.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
max_decode_table_size => HeaderTableSize
}, Config0),
@@ -2589,13 +2588,13 @@ settings_header_table_size_server(Config0) ->
{_, <<"200">>} = lists:keyfind(<<":status">>, 1, RespHeaders),
%% The decoding succeeded on the server, confirming that
%% the table size was updated to HeaderTableSize.
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
settings_max_concurrent_streams(Config0) ->
doc("The SETTINGS_MAX_CONCURRENT_STREAMS setting can be used to "
"restrict the number of concurrent streams. (RFC7540 5.1.2, RFC7540 6.5.2)"),
%% Create a new listener that allows only a single concurrent stream.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
max_concurrent_streams => 1
}, Config0),
@@ -2615,13 +2614,13 @@ settings_max_concurrent_streams(Config0) ->
]),
%% Receive a REFUSED_STREAM stream error.
{ok, << _:24, 3:8, _:8, 3:32, 7:32 >>} = gen_tcp:recv(Socket, 13, 6000),
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
settings_max_concurrent_streams_0(Config0) ->
doc("The SETTINGS_MAX_CONCURRENT_STREAMS setting can be set to "
"0 to refuse all incoming streams. (RFC7540 5.1.2, RFC7540 6.5.2)"),
%% Create a new listener that allows only a single concurrent stream.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
max_concurrent_streams => 0
}, Config0),
@@ -2636,7 +2635,7 @@ settings_max_concurrent_streams_0(Config0) ->
ok = gen_tcp:send(Socket, cow_http2:headers(1, fin, HeadersBlock)),
%% Receive a REFUSED_STREAM stream error.
{ok, << _:24, 3:8, _:8, 1:32, 7:32 >>} = gen_tcp:recv(Socket, 13, 6000),
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
%% @todo The client can limit the number of concurrent streams too. (RFC7540 5.1.2)
%
@@ -2659,7 +2658,7 @@ settings_initial_window_size(Config0) ->
doc("The SETTINGS_INITIAL_WINDOW_SIZE setting can be used to "
"change the initial window size of streams. (RFC7540 6.5.2)"),
%% Create a new listener that sets initial window sizes to 100000.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
initial_connection_window_size => 100000,
initial_stream_window_size => 100000
@@ -2701,14 +2700,14 @@ settings_initial_window_size(Config0) ->
{ok, _} = gen_tcp:recv(Socket, Len2, 6000),
%% No errors follow due to our sending of more than 65535 bytes of data.
{error, timeout} = gen_tcp:recv(Socket, 0, 1000),
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
settings_initial_window_size_after_ack(Config0) ->
doc("The SETTINGS_INITIAL_WINDOW_SIZE setting can be used to "
"change the initial window size of streams. It is applied "
"to all existing streams upon receipt of the SETTINGS ack. (RFC7540 6.5.2)"),
%% Create a new listener that sets the initial stream window sizes to 0.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
initial_stream_window_size => 0
}, Config0),
@@ -2741,14 +2740,14 @@ settings_initial_window_size_after_ack(Config0) ->
]),
%% Receive a FLOW_CONTROL_ERROR stream error.
{ok, << _:24, 3:8, _:8, 1:32, 3:32 >>} = gen_tcp:recv(Socket, 13, 6000),
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
settings_initial_window_size_before_ack(Config0) ->
doc("The SETTINGS_INITIAL_WINDOW_SIZE setting can be used to "
"change the initial window size of streams. It is only "
"applied upon receipt of the SETTINGS ack. (RFC7540 6.5.2)"),
%% Create a new listener that sets the initial stream window sizes to 0.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
initial_stream_window_size => 0
}, Config0),
@@ -2786,13 +2785,13 @@ settings_initial_window_size_before_ack(Config0) ->
{ok, _} = gen_tcp:recv(Socket, Len2, 6000),
%% No errors follow due to our sending of more than 0 bytes of data.
{error, timeout} = gen_tcp:recv(Socket, 0, 1000),
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
settings_max_frame_size(Config0) ->
doc("The SETTINGS_MAX_FRAME_SIZE setting can be used to "
"change the maximum frame size allowed. (RFC7540 6.5.2)"),
%% Create a new listener that sets the maximum frame size to 30000.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
max_frame_size_received => 30000
}, Config0),
@@ -2816,7 +2815,7 @@ settings_max_frame_size(Config0) ->
{ok, _} = gen_tcp:recv(Socket, Len2, 6000),
%% No errors follow due to our sending of a 25000 bytes frame.
{error, timeout} = gen_tcp:recv(Socket, 0, 1000),
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
settings_max_frame_size_reject_too_small(Config) ->
doc("A SETTINGS_MAX_FRAME_SIZE smaller than 16384 must be rejected "
@@ -3012,7 +3011,7 @@ data_reject_overflow(Config0) ->
"to overflow must be rejected with a FLOW_CONTROL_ERROR "
"connection error. (RFC7540 6.9.1)"),
%% Create a new listener that allows only a single concurrent stream.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
initial_stream_window_size => 100000
}, Config0),
@@ -3037,14 +3036,14 @@ data_reject_overflow(Config0) ->
]),
%% Receive a FLOW_CONTROL_ERROR connection error.
{ok, << _:24, 7:8, _:72, 3:32 >>} = gen_tcp:recv(Socket, 17, 6000),
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
data_reject_overflow_stream(Config0) ->
doc("DATA frames that cause the stream flow control window "
"to overflow must be rejected with a FLOW_CONTROL_ERROR "
"stream error. (RFC7540 6.9.1)"),
%% Create a new listener that allows only a single concurrent stream.
- Config = cowboy_test:init_http(name(), #{
+ Config = cowboy_test:init_http(?FUNCTION_NAME, #{
env => #{dispatch => cowboy_router:compile(init_routes(Config0))},
initial_connection_window_size => 100000
}, Config0),
@@ -3082,7 +3081,7 @@ data_reject_overflow_stream(Config0) ->
]),
%% Receive a FLOW_CONTROL_ERROR stream error.
{ok, << _:24, 3:8, _:8, 1:32, 3:32 >>} = gen_tcp:recv(Socket, 13, 6000),
- cowboy:stop_listener(name()).
+ cowboy:stop_listener(?FUNCTION_NAME).
%% (RFC7540 6.9.1)
% Frames with zero length with the END_STREAM flag set (that