fix seesion and connectiong test suites

This commit is contained in:
Gilbert Wong 2018-08-31 19:15:17 +08:00
parent 3f42f1271b
commit 14ba395c21
3 changed files with 31 additions and 9 deletions

View File

@ -19,12 +19,29 @@
-include_lib("common_test/include/ct.hrl").
all() -> [t_attrs].
all() ->
[{group, connection}].
groups() ->
[{connection, [sequence], [t_attrs]}].
init_per_suite(Config) ->
emqx_ct_broker_helpers:run_setup_steps(),
Config.
end_per_suite(_Config) ->
emqx_ct_broker_helpers:run_teardown_steps().
t_attrs(_) ->
emqx_ct_broker_helpers:run_setup_steps(),
{ok, C, _} = emqx_client:start_link([{host, "localhost"}, {client_id, <<"simpleClient">>}, {username, <<"plain">>}, {password, <<"plain">>}]),
[{<<"simpleClient">>, ConnPid}] = emqx_cm:lookup_connection(<<"simpleClient">>),
Attrs = emqx_connection:attrs(ConnPid),
<<"simpleClient">> = proplists:get_value(client_id, Attrs),
<<"plain">> = proplists:get_value(username, Attrs).
<<"plain">> = proplists:get_value(username, Attrs),
emqx_client:disconnect(C).
%% t_stats() ->
%% {ok, C, _ } = emqx_client;
%% t_stats() ->

View File

@ -28,15 +28,14 @@ all() ->
[start_stop_listeners,
restart_listeners].
init_per_suite() ->
init_per_suite(Config) ->
NewConfig = generate_config(),
application:ensure_all_started(esockd),
lists:foreach(fun set_app_env/1, NewConfig),
ok.
Config.
end_per_suite() ->
application:stop(esockd),
ok.
end_per_suite(_Config) ->
application:stop(esockd).
start_stop_listeners(_) ->
ok = emqx_listeners:start(),

View File

@ -21,8 +21,14 @@
all() -> [t_session_all].
t_session_all(_) ->
init_per_suite(Config) ->
emqx_ct_broker_helpers:run_setup_steps(),
Config.
end_per_suite(_Config) ->
emqx_ct_broker_helpers:run_teardown_steps().
t_session_all(_) ->
ClientId = <<"ClientId">>,
{ok, ConnPid} = emqx_mock_client:start_link(ClientId),
{ok, SPid} = emqx_mock_client:open_session(ConnPid, ClientId, internal),