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

0118 for better test coverage
This commit is contained in:
Zaiming (Stone) Shi 2023-05-02 13:26:22 +02:00 committed by GitHub
commit cad4144773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 13 deletions

View File

@ -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]},

View File

@ -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}),

View File

@ -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)
).