Skip to content

Commit

Permalink
test(cc-alg): add a test in ct
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhuyan committed Oct 7, 2024
1 parent 3c8caec commit 7200040
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
1 change: 0 additions & 1 deletion include/quicer.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -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
37 changes: 37 additions & 0 deletions test/quicer_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
%%% ====================
Expand Down

0 comments on commit 7200040

Please sign in to comment.