Skip to content

Commit 1301782

Browse files
authored
test: add test to cover #351 (#353)
1 parent 8f14a8e commit 1301782

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/quicer_SUITE.erl

+31
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
tc_stream_client_send_binary/1,
5252
tc_stream_client_send_iolist/1,
5353
tc_stream_client_async_send/1,
54+
tc_stream_client_send_seq/1,
5455

5556
tc_stream_passive_receive/1,
5657
tc_stream_passive_receive_shutdown/1,
@@ -397,6 +398,36 @@ tc_stream_client_send_binary(Config) ->
397398
ct:fail("timeout")
398399
end.
399400

401+
tc_stream_client_send_seq(Config) ->
402+
Port = select_port(),
403+
Owner = self(),
404+
{SPid, Ref} = spawn_monitor(fun() -> echo_server(Owner, Config, Port) end),
405+
receive
406+
listener_ready ->
407+
{ok, Conn} = quicer:connect("localhost", Port, default_conn_opts(), 5000),
408+
{ok, Stm} = quicer:start_stream(Conn, []),
409+
{ok, 1} = quicer:send(Stm, <<16>>),
410+
Payload = list_to_binary(lists:seq(2, 30)),
411+
Len = byte_size(Payload),
412+
{ok, 33} = quicer:send(Stm, <<Len:32, Payload/binary>>),
413+
flush_streams_available(Conn),
414+
flush_datagram_state_changed(Conn),
415+
receive
416+
{quic, <<16, Len:32, _/binary>>, _, _} ->
417+
ok = quicer:close_stream(Stm),
418+
ok = quicer:close_connection(Conn);
419+
{quic, <<16>>, _, _} ->
420+
ok = quicer:close_stream(Stm),
421+
ok = quicer:close_connection(Conn);
422+
Other ->
423+
ct:fail("Unexpected Msg ~p", [Other])
424+
end,
425+
SPid ! done,
426+
ok = ensure_server_exit_normal(Ref)
427+
after 1000 ->
428+
ct:fail("timeout")
429+
end.
430+
400431
tc_stream_client_send_iolist(Config) ->
401432
Port = 4569,
402433
Owner = self(),

0 commit comments

Comments
 (0)