test(session): fix test cases
This commit is contained in:
parent
b782d4c53a
commit
26ba1b630c
|
@ -169,18 +169,16 @@ init(Opts) ->
|
|||
MaxInflight = maps:get(max_inflight, Opts, 1),
|
||||
QueueOpts = maps:merge(
|
||||
#{max_len => 1000,
|
||||
store_qos0 => false,
|
||||
priorities => none,
|
||||
default_priority => lowest
|
||||
store_qos0 => true
|
||||
}, maps:get(mqueue, Opts, #{})),
|
||||
#session{
|
||||
max_subscriptions = maps:get(max_subscriptions, Opts, 0),
|
||||
max_subscriptions = maps:get(max_subscriptions, Opts, infinity),
|
||||
subscriptions = #{},
|
||||
upgrade_qos = maps:get(upgrade_qos, Opts, false),
|
||||
inflight = emqx_inflight:new(MaxInflight),
|
||||
mqueue = emqx_mqueue:init(QueueOpts),
|
||||
next_pkt_id = 1,
|
||||
retry_interval = timer:seconds(maps:get(retry_interval, Opts, 0)),
|
||||
retry_interval = timer:seconds(maps:get(retry_interval, Opts, 30)),
|
||||
awaiting_rel = #{},
|
||||
max_awaiting_rel = maps:get(max_awaiting_rel, Opts, 100),
|
||||
await_rel_timeout = timer:seconds(maps:get(await_rel_timeout, Opts, 300)),
|
||||
|
|
|
@ -983,8 +983,7 @@ session(InitFields) when is_map(InitFields) ->
|
|||
maps:fold(fun(Field, Value, Session) ->
|
||||
emqx_session:set_field(Field, Value, Session)
|
||||
end,
|
||||
emqx_session:init(#{zone => default, listener => mqtt_tcp},
|
||||
#{receive_maximum => 0}),
|
||||
emqx_session:init(#{max_inflight => 0}),
|
||||
InitFields).
|
||||
|
||||
%% conn: 5/s; overall: 10/s
|
||||
|
|
|
@ -509,9 +509,7 @@ channel(InitFields) ->
|
|||
peercert => undefined,
|
||||
mountpoint => undefined
|
||||
},
|
||||
Session = emqx_session:init(#{zone => default, listener => mqtt_tcp},
|
||||
#{receive_maximum => 0}
|
||||
),
|
||||
Session = emqx_session:init(#{max_inflight => 0}),
|
||||
maps:fold(fun(Field, Value, Channel) ->
|
||||
emqx_channel:set_field(Field, Value, Channel)
|
||||
end,
|
||||
|
|
|
@ -51,8 +51,7 @@ end_per_testcase(_TestCase, Config) ->
|
|||
%%--------------------------------------------------------------------
|
||||
|
||||
t_session_init(_) ->
|
||||
Session = emqx_session:init(#{zone => default, listener => mqtt_tcp},
|
||||
#{receive_maximum => 64}),
|
||||
Session = emqx_session:init(#{max_inflight => 64}),
|
||||
?assertEqual(#{}, emqx_session:info(subscriptions, Session)),
|
||||
?assertEqual(0, emqx_session:info(subscriptions_cnt, Session)),
|
||||
?assertEqual(infinity, emqx_session:info(subscriptions_max, Session)),
|
||||
|
@ -377,8 +376,7 @@ session(InitFields) when is_map(InitFields) ->
|
|||
maps:fold(fun(Field, Value, Session) ->
|
||||
emqx_session:set_field(Field, Value, Session)
|
||||
end,
|
||||
emqx_session:init(#{zone => default, listener => mqtt_tcp},
|
||||
#{receive_maximum => 0}),
|
||||
emqx_session:init(#{max_inflight => 0}),
|
||||
InitFields).
|
||||
|
||||
|
||||
|
|
|
@ -468,9 +468,7 @@ channel(InitFields) ->
|
|||
peercert => undefined,
|
||||
mountpoint => undefined
|
||||
},
|
||||
Session = emqx_session:init(#{zone => default, listener => mqtt_ws},
|
||||
#{receive_maximum => 0}
|
||||
),
|
||||
Session = emqx_session:init(#{max_inflight => 0}),
|
||||
maps:fold(fun(Field, Value, Channel) ->
|
||||
emqx_channel:set_field(Field, Value, Channel)
|
||||
end,
|
||||
|
|
Loading…
Reference in New Issue