Fix compile warning

This commit is contained in:
turtled 2019-12-03 19:15:04 +08:00
parent 8bf06b9c63
commit 13b625f729
3 changed files with 12 additions and 13 deletions

View File

@ -95,7 +95,7 @@ t_chan_attrs(_) ->
#{conn_state := connected} = emqx_channel:attrs(channel()).
t_chan_caps(_) ->
Caps = emqx_channel:caps(channel()).
_Caps = emqx_channel:caps(channel()).
%%--------------------------------------------------------------------
%% Test cases for channel init
@ -103,7 +103,7 @@ t_chan_caps(_) ->
%% TODO:
t_chan_init(_) ->
Channel = channel().
_Channel = channel().
%%--------------------------------------------------------------------
%% Test cases for channel handle_in
@ -154,7 +154,7 @@ t_handle_in_qos2_publish(_) ->
t_handle_in_puback_ok(_) ->
Msg = emqx_message:make(<<"t">>, <<"payload">>),
ok = meck:expect(emqx_session, puback,
fun(PacketId, Session) -> {ok, Msg, Session} end),
fun(_PacketId, Session) -> {ok, Msg, Session} end),
Channel = channel(#{conn_state => connected}),
{ok, _NChannel} = emqx_channel:handle_in(?PUBACK_PACKET(1, ?RC_SUCCESS), Channel).
% ?assertEqual(#{puback_in => 1}, emqx_channel:info(pub_stats, NChannel)).
@ -186,7 +186,7 @@ t_handle_in_pubrec_ok(_) ->
t_handle_in_pubrec_id_in_use(_) ->
ok = meck:expect(emqx_session, pubrec,
fun(_, Session) ->
fun(_, _Session) ->
{error, ?RC_PACKET_IDENTIFIER_IN_USE}
end),
{ok, ?PUBREL_PACKET(1, ?RC_PACKET_IDENTIFIER_IN_USE), _Channel}
@ -196,7 +196,7 @@ t_handle_in_pubrec_id_in_use(_) ->
t_handle_in_pubrec_id_not_found(_) ->
ok = meck:expect(emqx_session, pubrec,
fun(_, Session) ->
fun(_, _Session) ->
{error, ?RC_PACKET_IDENTIFIER_NOT_FOUND}
end),
{ok, ?PUBREL_PACKET(1, ?RC_PACKET_IDENTIFIER_NOT_FOUND), _Channel}
@ -360,7 +360,7 @@ t_handle_out_publish_nl(_) ->
{ok, Channel} = emqx_channel:handle_out(Publish, Channel).
t_handle_out_connack_sucess(_) ->
{ok, [{connack, ?CONNACK_PACKET(?RC_SUCCESS, SP, _)}], _Chan}
{ok, [{connack, ?CONNACK_PACKET(?RC_SUCCESS, _SP, _)}], _Chan}
= emqx_channel:handle_out(connack, {?RC_SUCCESS, 0, connpkt()}, channel()).
t_handle_out_connack_failure(_) ->
@ -459,13 +459,13 @@ t_handle_timeout_emit_stats(_) ->
t_handle_timeout_keepalive(_) ->
TRef = make_ref(),
Channel = emqx_channel:set_field(timers, #{alive_timer => TRef}, channel()),
_Channel = emqx_channel:set_field(timers, #{alive_timer => TRef}, channel()),
{ok, _Chan} = emqx_channel:handle_timeout(make_ref(), {keepalive, 10}, channel()).
t_handle_timeout_retry_delivery(_) ->
ok = meck:expect(emqx_session, retry, fun(Session) -> {ok, Session} end),
TRef = make_ref(),
Channel = emqx_channel:set_field(timers, #{retry_timer => TRef}, channel()),
_Channel = emqx_channel:set_field(timers, #{retry_timer => TRef}, channel()),
{ok, _Chan} = emqx_channel:handle_timeout(TRef, retry_delivery, channel()).
t_handle_timeout_expire_awaiting_rel(_) ->

View File

@ -251,7 +251,7 @@ t_basic_with_props_v5(_) ->
%% General test cases.
%%--------------------------------------------------------------------
t_basic(Opts) ->
t_basic(_Opts) ->
Topic = nth(1, ?TOPICS),
{ok, C} = emqtt:start_link([{proto_ver, v4}]),
{ok, _} = emqtt:connect(C),

View File

@ -128,12 +128,12 @@ t_publish_qos2(_) ->
t_publish_qos1(_) ->
ok = meck:expect(emqx_broker, publish, fun(_) -> [] end),
Msg = emqx_message:make(test, ?QOS_1, <<"t">>, <<"payload">>),
{ok, [], Session} = emqx_session:publish(1, Msg, session()).
{ok, [], _Session} = emqx_session:publish(1, Msg, session()).
t_publish_qos0(_) ->
ok = meck:expect(emqx_broker, publish, fun(_) -> [] end),
Msg = emqx_message:make(test, ?QOS_1, <<"t">>, <<"payload">>),
{ok, [], Session} = emqx_session:publish(0, Msg, session()).
{ok, [], _Session} = emqx_session:publish(0, Msg, session()).
t_is_awaiting_full_false(_) ->
?assertNot(emqx_session:is_awaiting_full(session(#{max_awaiting_rel => 0}))).
@ -196,7 +196,7 @@ t_pubcomp_id_not_found(_) ->
%%--------------------------------------------------------------------
t_dequeue(_) ->
{ok, Session} = emqx_session:dequeue(session()).
{ok, _Session} = emqx_session:dequeue(session()).
t_deliver(_) ->
Delivers = [delivery(?QOS_1, <<"t1">>), delivery(?QOS_2, <<"t2">>)],
@ -222,7 +222,6 @@ t_takeover(_) ->
t_resume(_) ->
ok = meck:expect(emqx_broker, subscribe, fun(_, _, _) -> ok end),
Subs = #{<<"t">> => ?DEFAULT_SUBOPTS},
Session = session(#{subscriptions => #{<<"t">> => ?DEFAULT_SUBOPTS}}),
ok = emqx_session:resume(<<"clientid">>, Session).