From 7200040fb95c63f2fc9346705027df2cce5293e3 Mon Sep 17 00:00:00 2001 From: William Yang Date: Mon, 7 Oct 2024 11:28:41 +0200 Subject: [PATCH] test(cc-alg): add a test in ct --- include/quicer.hrl | 1 - test/quicer_SUITE.erl | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/include/quicer.hrl b/include/quicer.hrl index 24de956e..9a7f969a 100644 --- a/include/quicer.hrl +++ b/include/quicer.hrl @@ -148,6 +148,5 @@ -define(QUIC_CONGESTION_CONTROL_ALGORITHM_CUBIC, 0). -define(QUIC_CONGESTION_CONTROL_ALGORITHM_BBR, 1). --define(QUIC_CONGESTION_CONTROL_ALGORITHM_MAX, 2). -endif. %% QUICER_HRL diff --git a/test/quicer_SUITE.erl b/test/quicer_SUITE.erl index 74d5d589..fcd8c11e 100644 --- a/test/quicer_SUITE.erl +++ b/test/quicer_SUITE.erl @@ -91,6 +91,7 @@ tc_setopt/1, tc_setopt_remote_addr/1, tc_getopt_settings/1, + tc_setopt_congestion_control_algorithm/1, %% @TODO following two tcs are failing due to: % https://github.com/microsoft/msquic/issues/2033 @@ -3162,6 +3163,42 @@ tc_setopt_global_lb_mode_ifip(_Config) -> quicer:getopt(quic_global, load_balacing_mode) ). +tc_setopt_congestion_control_algorithm(Config) -> + Port = select_port(), + Owner = self(), + {SPid, _Ref} = spawn_monitor( + fun() -> + echo_server(Owner, Config, Port) + end + ), + receive + listener_ready -> + ok + after 5000 -> + ct:fail("listener_timeout") + end, + {ok, Conn} = quicer:connect( + "localhost", + Port, + [ + {congestion_control_algorithm, ?QUIC_CONGESTION_CONTROL_ALGORITHM_BBR} + | default_conn_opts() + ], + 5000 + ), + {ok, Stm} = quicer:start_stream(Conn, []), + {ok, 4} = quicer:send(Stm, <<"ping">>), + + {ok, Settings} = quicer:getopt(Conn, settings), + ?assertMatch( + ?QUIC_CONGESTION_CONTROL_ALGORITHM_BBR, + proplists:get_value(congestion_control_algorithm, Settings) + ), + + quicer:shutdown_connection(Conn), + SPid ! done, + ok. + %%% ==================== %%% Internal helpers %%% ====================