周子博 7 лет назад
Родитель
Сommit
e56252dac6
2 измененных файлов с 18 добавлено и 10 удалено
  1. 9 8
      test/emqx_mock_client.erl
  2. 9 2
      test/emqx_sm_SUITE.erl

+ 9 - 8
test/emqx_mock_client.erl

@@ -46,14 +46,15 @@ init([ClientId]) ->
     }.
     }.
 
 
 handle_call({start_session, ClientPid, ClientId, Zone}, _From, State) ->
 handle_call({start_session, ClientPid, ClientId, Zone}, _From, State) ->
-    Attrs = #{ zone             => Zone,
-               client_id        => ClientId,
-               conn_pid         => ClientPid,
-               clean_start      => true,
-               username         => undefined,
-               expiry_interval  => 0,
-               max_inflight     => 0,
-               topic_alias_maximum => 0
+    Attrs = #{ zone                 => Zone,
+               client_id            => ClientId,
+               conn_pid             => ClientPid,
+               clean_start          => true,
+               username             => undefined,
+               expiry_interval      => 0,
+               max_inflight         => 0,
+               topic_alias_maximum  => 0,
+               will_msg             => undefined
              },
              },
     {ok, SessPid} = emqx_sm:open_session(Attrs),
     {ok, SessPid} = emqx_sm:open_session(Attrs),
     {reply, {ok, SessPid},
     {reply, {ok, SessPid},

+ 9 - 2
test/emqx_sm_SUITE.erl

@@ -24,8 +24,15 @@ all() -> [t_open_close_session].
 t_open_close_session(_) ->
 t_open_close_session(_) ->
     emqx_ct_broker_helpers:run_setup_steps(),
     emqx_ct_broker_helpers:run_setup_steps(),
     {ok, ClientPid} = emqx_mock_client:start_link(<<"client">>),
     {ok, ClientPid} = emqx_mock_client:start_link(<<"client">>),
-    Attrs = #{clean_start => true, client_id => <<"client">>, conn_pid => ClientPid,
-              zone => internal, username => <<"zhou">>, expiry_interval => 0, max_inflight => 0, topic_alias_maximum => 0},
+    Attrs = #{clean_start         => true, 
+              client_id           => <<"client">>, 
+              conn_pid            => ClientPid,
+              zone                => internal, 
+              username            => <<"zhou">>, 
+              expiry_interval     => 0, 
+              max_inflight        => 0, 
+              topic_alias_maximum => 0,
+              will_msg            => undefined},
     {ok, SPid} = emqx_sm:open_session(Attrs),
     {ok, SPid} = emqx_sm:open_session(Attrs),
     [{<<"client">>, SPid}] = emqx_sm:lookup_session(<<"client">>),
     [{<<"client">>, SPid}] = emqx_sm:lookup_session(<<"client">>),
     SPid = emqx_sm:lookup_session_pid(<<"client">>),
     SPid = emqx_sm:lookup_session_pid(<<"client">>),