Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhuyan committed May 21, 2024
1 parent 4f4d649 commit 4b459e1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
42 changes: 22 additions & 20 deletions test/prop_stateful_server_conn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,27 @@
prop_server_state_test(opts) ->
[{numtests, 2000}].
prop_server_state_test() ->
%% dbg:tracer(process, {fun dbg:dhandler/2,group_leader()}),
%% dbg:p(self(), c),
%% dbg:tp(quicer, cx),
process_flag(trap_exit, true),
{ok, L} = quicer:listen(?PORT, default_listen_opts()),
put(listener, L),
?FORALL(
Cmds,
commands(?MODULE),
begin
{History, State, Result} = run_commands(?MODULE, Cmds),
?WHENFAIL(
io:format(
"History: ~p\nState: ~p\nResult: ~p\n",
[History, State, Result]
),
aggregate(command_names(Cmds), Result =:= ok)
)
end
?SETUP(
fun() ->
{ok, L} = quicer:listen(?PORT, default_listen_opts()),
put(listener, L),
fun() -> quicer:close_listener(L) end
end,
?FORALL(
Cmds,
commands(?MODULE),
begin
{History, State, Result} = run_commands(?MODULE, Cmds),
?WHENFAIL(
io:format(
"History: ~p\nState: ~p\nResult: ~p\n",
[History, State, Result]
),
aggregate(command_names(Cmds), Result =:= ok)
)
end
)
).

%%%%%%%%%%%%%
Expand All @@ -63,7 +65,7 @@ prop_server_state_test() ->
%% @doc Initial model value at system start. Should be deterministic.
initial_state() ->
process_flag(trap_exit, true),
{ok, L} = quicer:async_accept(get(listener), #{active => false}),
{ok, _L} = quicer:async_accept(get(listener), #{active => false}),

%%% We don't care about the client thus no linking.
spawn(fun() ->
Expand Down Expand Up @@ -265,7 +267,7 @@ postcondition(
is_pid(NewOwner);
%% postcondition(#{owner := Owner, state := closed} = State, {call, quicer, controlling_process, [_, _]}, {error, not_owner}) ->
%% true;
postcondition(#{handle := H, state := S}, {call, quicer, get_connections, _}, Conns) when
postcondition(#{handle := _H, state := _S}, {call, quicer, get_connections, _}, Conns) when
is_list(Conns)
->
%% @TODO check why handle is not member
Expand Down
4 changes: 2 additions & 2 deletions test/prop_stateful_stream.erl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ prop_stateful_client_stream_test() ->
commands(?MODULE),
begin
flush_quic_msgs(),
{ok, H} = quicer:connect("localhost", 14569, default_conn_opts(), 10000),
{ok, H} = quicer:connect("localhost", 14571, default_conn_opts(), 10000),
{History, State, Result} = run_commands(?MODULE, Cmds, [{conn_handle, H}]),
quicer:async_shutdown_connection(H, ?QUIC_CONNECTION_SHUTDOWN_FLAG_SILENT, 0),
?WHENFAIL(
Expand Down Expand Up @@ -272,7 +272,7 @@ flush_quic_msgs() ->
%%%%%%%%%%%%%%%%%%%%%%%
listener_start_link(ListenerName) ->
application:ensure_all_started(quicer),
LPort = 14569,
LPort = 14571,
ListenerOpts = default_listen_opts(),
ConnectionOpts = [
{conn_callback, example_server_connection},
Expand Down

0 comments on commit 4b459e1

Please sign in to comment.