From ffdab5b2bc33eab2c03a0112269278383bc6aac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 2 Jan 2025 15:27:24 +0100 Subject: [PATCH] Fix test suite for HTTP/2 and use Gun branch with fixes --- Makefile | 2 +- test/ws_perf_SUITE.erl | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 6ffdfc4f..15e6e3c8 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ DOC_DEPS = asciideck TEST_DEPS = $(if $(CI_ERLANG_MK),ci.erlang.mk) ct_helper gun dep_ct_helper = git https://github.com/extend/ct_helper master -dep_gun = git https://github.com/ninenines/gun master +dep_gun = git https://github.com/ninenines/gun optimise-websocket-bug-fixes # CI configuration. diff --git a/test/ws_perf_SUITE.erl b/test/ws_perf_SUITE.erl index 4aa9e654..193af1b6 100644 --- a/test/ws_perf_SUITE.erl +++ b/test/ws_perf_SUITE.erl @@ -44,9 +44,13 @@ init_per_group(Name=http, Config) -> init_per_group(Name=h2c, Config) -> ct:pal("Websocket over cleartext HTTP/2"), Config1 = cowboy_test:init_http(Name, #{ + connection_window_margin_size => 64*1024, enable_connect_protocol => true, env => #{dispatch => init_dispatch(Config)}, - max_frame_size_received => 1048576 + max_frame_size_sent => 8*1024, + max_frame_size_received => 16384 * 1024 - 1, + stream_window_data_threshold => 1024, + stream_window_margin_size => 64*1024 }, [{flavor, vanilla}|Config]), lists:keyreplace(protocol, 1, Config1, {protocol, http2}). @@ -66,8 +70,12 @@ init_dispatch(_Config) -> do_gun_open_ws(Config) -> ConnPid = gun_open(Config, #{http2_opts => #{ - max_frame_size_received => 1048576, - notify_settings_changed => true + connection_window_margin_size => 64*1024, + max_frame_size_sent => 8*1024, + max_frame_size_received => 16384 * 1024 - 1, + notify_settings_changed => true, + stream_window_data_threshold => 1024, + stream_window_margin_size => 64*1024 }}), case config(protocol, Config) of http -> ok; @@ -91,7 +99,7 @@ receive_ws(ConnPid, StreamRef) -> receive {gun_ws, ConnPid, StreamRef, Frame} -> {ok, Frame} - after 5000 -> + after 15000 -> {error, timeout} end. @@ -113,9 +121,10 @@ one_binary_04096KiB(Config) -> doc("Send and receive a 4096KiB binary frame."), do_full(Config, one, 1, binary, 4096 * 1024). +%% Minus one because frames can only get so big. one_binary_16384KiB(Config) -> - doc("Send and receive a 16384KiB binary frame."), - do_full(Config, one, 1, binary, 16384 * 1024). + doc("Send and receive a 16384KiB - 1 binary frame."), + do_full(Config, one, 1, binary, 16384 * 1024 - 1). one_text_00064KiB(Config) -> doc("Send and receive a 64KiB text frame."), @@ -133,9 +142,10 @@ one_text_04096KiB(Config) -> doc("Send and receive a 4096KiB text frame."), do_full(Config, one, 1, text, 4096 * 1024). +%% Minus one because frames can only get so big. one_text_16384KiB(Config) -> - doc("Send and receive a 16384KiB text frame."), - do_full(Config, one, 1, text, 16384 * 1024). + doc("Send and receive a 16384KiB - 1 text frame."), + do_full(Config, one, 1, text, 16384 * 1024 - 1). repeat_binary_00000B(Config) -> doc("Send and receive a 0B binary frame 1000 times."), @@ -184,7 +194,7 @@ do_full(Config, What, Num, FrameType, FrameSize) -> binary -> rand:bytes(FrameSize) end, {Time, _} = timer:tc(?MODULE, do_full1, [ConnPid, StreamRef, Num, FrameType, FrameData]), - do_log("~-6s ~-6s ~6s: ~7bµs", [What, FrameType, do_format_size(FrameSize), Time]), + do_log("~-6s ~-6s ~6s: ~8bµs", [What, FrameType, do_format_size(FrameSize), Time]), gun:ws_send(ConnPid, StreamRef, close), {ok, close} = receive_ws(ConnPid, StreamRef), gun_down(ConnPid).