Fix test case (#2275)

* Fix t_rpc test
This commit is contained in:
Gilbert 2019-02-28 18:07:16 +08:00 committed by turtleDeng
parent f1d751dd95
commit c26d13b057
3 changed files with 15 additions and 15 deletions

View File

@ -27,17 +27,17 @@ TEST_ERLC_OPTS += +debug_info -DAPPLICATION=emqx
EUNIT_OPTS = verbose EUNIT_OPTS = verbose
CT_SUITES = emqx_bridge # CT_SUITES = emqx_bridge
## emqx_trie emqx_router emqx_frame emqx_mqtt_compat ## emqx_trie emqx_router emqx_frame emqx_mqtt_compat
# CT_SUITES = emqx emqx_client emqx_zone emqx_banned emqx_session \ CT_SUITES = emqx emqx_client emqx_zone emqx_banned emqx_session \
# emqx_access emqx_broker emqx_cm emqx_frame emqx_guid emqx_inflight emqx_json \ emqx_access emqx_broker emqx_cm emqx_frame emqx_guid emqx_inflight emqx_json \
# emqx_keepalive emqx_lib emqx_metrics emqx_mod emqx_mod_sup emqx_mqtt_caps \ emqx_keepalive emqx_lib emqx_metrics emqx_mod emqx_mod_sup emqx_mqtt_caps \
# emqx_mqtt_props emqx_mqueue emqx_net emqx_pqueue emqx_router emqx_sm \ emqx_mqtt_props emqx_mqueue emqx_net emqx_pqueue emqx_router emqx_sm \
# emqx_tables emqx_time emqx_topic emqx_trie emqx_vm emqx_mountpoint \ emqx_tables emqx_time emqx_topic emqx_trie emqx_vm emqx_mountpoint \
# emqx_listeners emqx_protocol emqx_pool emqx_shared_sub emqx_bridge \ emqx_listeners emqx_protocol emqx_pool emqx_shared_sub emqx_bridge \
# emqx_hooks emqx_batch emqx_sequence emqx_pmon emqx_pd emqx_gc emqx_ws_connection \ emqx_hooks emqx_batch emqx_sequence emqx_pmon emqx_pd emqx_gc emqx_ws_connection \
# emqx_packet emqx_connection emqx_tracer emqx_sys_mon emqx_message emqx_packet emqx_connection emqx_tracer emqx_sys_mon emqx_message
CT_NODE_NAME = emqxct@127.0.0.1 CT_NODE_NAME = emqxct@127.0.0.1
CT_OPTS = -cover test/ct.cover.spec -erl_args -name $(CT_NODE_NAME) CT_OPTS = -cover test/ct.cover.spec -erl_args -name $(CT_NODE_NAME)

View File

@ -29,8 +29,7 @@
all() -> [t_rpc, all() -> [t_rpc,
t_mqtt, t_mqtt,
t_mngr t_mngr].
].
init_per_suite(Config) -> init_per_suite(Config) ->
case node() of case node() of
@ -91,8 +90,10 @@ t_rpc(Config) when is_list(Config) ->
PacketId = 1, PacketId = 1,
emqx_session:publish(SPid, PacketId, Msg1), emqx_session:publish(SPid, PacketId, Msg1),
?wait(case emqx_mock_client:get_last_message(ConnPid) of ?wait(case emqx_mock_client:get_last_message(ConnPid) of
{publish, PacketId, #message{topic = <<"forwarded/t_rpc/one">>}} -> true; [{publish, PacketId, #message{topic = <<"forwarded/t_rpc/one">>}}] ->
Other -> Other true;
Other ->
Other
end, 4000), end, 4000),
emqx_mock_client:close_session(ConnPid) emqx_mock_client:close_session(ConnPid)
after after

View File

@ -20,7 +20,7 @@ ensure_mnesia_stopped() ->
ekka_mnesia:ensure_stopped(), ekka_mnesia:ensure_stopped(),
ekka_mnesia:delete_schema(). ekka_mnesia:delete_schema().
%% Help function to wait for Fun to yeild 'true'. %% Help function to wait for Fun to yield 'true'.
wait_for(Fn, Ln, F, Timeout) -> wait_for(Fn, Ln, F, Timeout) ->
{Pid, Mref} = erlang:spawn_monitor(fun() -> wait_loop(F, catch_call(F)) end), {Pid, Mref} = erlang:spawn_monitor(fun() -> wait_loop(F, catch_call(F)) end),
wait_for_down(Fn, Ln, Timeout, Pid, Mref, false). wait_for_down(Fn, Ln, Timeout, Pid, Mref, false).
@ -66,4 +66,3 @@ catch_call(F) ->
C : E : S -> C : E : S ->
{crashed, {C, E, S}} {crashed, {C, E, S}}
end. end.