Просмотр исходного кода

Merge pull request #10536 from zmstone/0118-for-better-test-coverage

0118 for better test coverage
Zaiming (Stone) Shi 2 лет назад
Родитель
Сommit
cad4144773

+ 1 - 1
apps/emqx_machine/src/emqx_machine.app.src

@@ -3,7 +3,7 @@
     {id, "emqx_machine"},
     {description, "The EMQX Machine"},
     % strict semver, bump manually!
-    {vsn, "0.2.2"},
+    {vsn, "0.2.3"},
     {modules, []},
     {registered, []},
     {applications, [kernel, stdlib, emqx_ctl]},

+ 1 - 12
apps/emqx_machine/src/emqx_machine.erl

@@ -43,7 +43,7 @@ start() ->
     start_sysmon(),
     configure_shard_transports(),
     ekka:start(),
-    ok = print_otp_version_warning().
+    ok.
 
 graceful_shutdown() ->
     emqx_machine_terminator:graceful_wait().
@@ -61,17 +61,6 @@ set_backtrace_depth() ->
 is_ready() ->
     emqx_machine_terminator:is_running().
 
--if(?OTP_RELEASE > 22).
-print_otp_version_warning() -> ok.
--else.
-print_otp_version_warning() ->
-    ?ULOG(
-        "WARNING: Running on Erlang/OTP version ~p. Recommended: 23~n",
-        [?OTP_RELEASE]
-    ).
-% OTP_RELEASE > 22
--endif.
-
 start_sysmon() ->
     _ = application:load(system_monitor),
     application:set_env(system_monitor, node_status_fun, {?MODULE, node_status}),

+ 10 - 0
apps/emqx_machine/test/emqx_machine_SUITE.erl

@@ -103,3 +103,13 @@ t_custom_shard_transports(_Config) ->
     emqx_machine:start(),
     ?assertEqual(distr, mria_config:shard_transport(Shard)),
     ok.
+
+t_node_status(_Config) ->
+    JSON = emqx_machine:node_status(),
+    ?assertMatch(
+        #{
+            <<"backend">> := _,
+            <<"role">> := <<"core">>
+        },
+        jsx:decode(JSON)
+    ).