emqx/test
terry-xiaoyu 997958aed1 Change the start_link API for emqx_client
Prior to this change, emqx_client:start_link does 2 works in one call:
- init an erlang process for emqx_client
- send MQTT CONNECT to remote broker

But this solution have some drawbacks:

- the return value of `start_link` compiles the return values of the 2
 works: {ok, Pid, MqttResult}. It is inconsistent with the return value
 of `gen_statem:start_link`, may causes confusions.

- the return mode of the 2 works are different:
  `start_link` should always return {ok, Pid} or {error, Reason}, but
 connecting to mqtt may throw out exceptions as it handles the
 socket. But the caller couldn't have thought of the exception, he would
 pattern match on the result of `emqx_client:start_link`, but it crashed!

- If the init work succeed but the connection failed, the caller couldn't
get a Pid from the return value, but indeed it was created inside the
emqx_client. This hides the fact that the Pid was created, and when the
Pid dies, the caller would receive an message from a Pid it doesn' know about.

This change divived these 2 work into 2 APIs:
- `start_link/1` is to build and verify the options, and returns {ok,Pid}
 (on success) or {error, Reason} (on failure).
- `connect/1` is to send MQTT CONNECT, and returns {ok, MQTTResult::properties()} or
 {error, MQTTReason}. MQTT reason codes will contains in the `MQTTReason`.
2018-11-09 17:43:04 +08:00
..
emqx_access_SUITE_data Merge with EMQ X project 2017-10-09 19:43:06 +08:00
emqx_SUITE_data Upgrade esockd and add more test cases 2018-05-22 13:01:19 +08:00
emqx_access_SUITE.erl fix listerners and access suites 2018-09-08 09:33:37 +02:00
emqx_acl_test_mod.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_auth_anonymous_test_mod.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_auth_dashboard.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_banned_SUITE.erl Improve test cases, and fix some bugs (#1920) 2018-10-26 17:27:02 +08:00
emqx_bridge_SUITE.erl Add test cases for emqx_bridge, emqx_mod_rewrite (#1914) 2018-10-26 14:04:33 +08:00
emqx_broker_SUITE.erl Improve test cases, and fix some bugs (#1920) 2018-10-26 17:27:02 +08:00
emqx_client_SUITE.erl Change the start_link API for emqx_client 2018-11-09 17:43:04 +08:00
emqx_cm_SUITE.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_ct_broker_helpers.erl Generate a config file for testing 2018-09-07 07:04:04 +02:00
emqx_ct_helpers.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_frame_SUITE.erl Replace macro QOS$i to QOS_$I 2018-11-08 20:42:31 +08:00
emqx_gc_tests.erl Rewrite emqx_gc.erl 2018-09-21 22:56:34 +08:00
emqx_guid_SUITE.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_hooks_SUITE.erl Improve coverage for emqx_hooks, and add test case for emqx_mod_sup (#1892) 2018-10-19 16:21:43 +08:00
emqx_inflight_SUITE.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_json_SUITE.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_keepalive_SUITE.erl Make more normalize 2018-10-26 17:45:13 +08:00
emqx_lib_SUITE.erl update emqx_lib_suite and delete duplicate test case 2018-08-29 14:52:35 +08:00
emqx_listeners_SUITE.erl Remove check for MQTT path, and normalize code 2018-09-14 11:49:17 +08:00
emqx_message_SUITE.erl Replace macro QOS$i to QOS_$I 2018-11-08 20:42:31 +08:00
emqx_metrics_SUITE.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_misc_tests.erl Merged emqx_misc_SUITE to emqx_misc_tests (#1890) 2018-10-19 09:46:25 +02:00
emqx_mock_client.erl Fix bugs in test cases 2018-10-26 14:34:22 +08:00
emqx_mod_rewrite_tests.erl Add test cases for emqx_bridge, emqx_mod_rewrite (#1914) 2018-10-26 14:04:33 +08:00
emqx_mod_SUITE.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_mod_sup_SUITE.erl Improve coverage for emqx_hooks, and add test case for emqx_mod_sup (#1892) 2018-10-19 16:21:43 +08:00
emqx_mountpoint_SUITE.erl Replace macro QOS$i to QOS_$I 2018-11-08 20:42:31 +08:00
emqx_mqtt_caps_SUITE.erl Improve topic alias maximum in connect packet 2018-09-29 14:47:21 +08:00
emqx_mqtt_packet_SUITE.erl Add test case for mqtt5 connect packet 2018-09-06 18:09:58 +08:00
emqx_mqtt_props_SUITE.erl Rename emqx_mqtt_properties module to emqx_mqtt_props 2018-09-06 18:09:22 +08:00
emqx_mqueue_SUITE.erl Rewrite emqx_mqueue.erl 2018-10-27 14:21:53 +02:00
emqx_net_SUITE.erl Revert "Calculate the 1.5 keep alive time exactly" 2018-09-22 14:52:31 +08:00
emqx_packet_SUITE.erl Replace macro QOS$i to QOS_$I 2018-11-08 20:42:31 +08:00
emqx_pool_SUITE.erl Fix function args 2018-09-18 09:15:46 +08:00
emqx_pqueue_SUITE.erl Improve test cases, and fix some bugs (#1920) 2018-10-26 17:27:02 +08:00
emqx_protocol_SUITE.erl Implement will message delay publish in session, add test case for clean start and will message in connect packet 2018-10-25 14:26:31 +08:00
emqx_protocol_tests.erl Add eunit cases and fix typo. 2018-10-24 15:59:22 +08:00
emqx_router_SUITE.erl Improve test cases, and fix some bugs (#1920) 2018-10-26 17:27:02 +08:00
emqx_session_SUITE.erl Refine emqx_mock_client 2018-09-22 10:51:38 +02:00
emqx_shared_sub_SUITE.erl Refine emqx_mock_client 2018-09-22 10:51:38 +02:00
emqx_sm_SUITE.erl Fix bugs in test cases 2018-10-26 14:34:22 +08:00
emqx_stats_tests.erl Change more stats callbacks to full M:F/A 2018-10-19 00:22:29 +08:00
emqx_SUITE.erl Fix bug in test case 2018-10-26 10:46:56 +08:00
emqx_tables_SUITE.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_time_SUITE.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_topic_SUITE.erl Request & Response (broker and client) (#1819) 2018-10-18 19:21:05 +02:00
emqx_trie_SUITE.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_vm_SUITE.erl Update copyright 2018-08-28 20:37:46 +08:00
emqx_zone_SUITE.erl Code Review: Update the zone module 2018-09-07 10:26:14 +08:00
rfc6455_client.erl Request & Response (broker and client) (#1819) 2018-10-18 19:21:05 +02:00
ws_client.erl Request & Response (broker and client) (#1819) 2018-10-18 19:21:05 +02:00