test: improve emqx_mgmt_api_stats test coverage to 100%
This commit is contained in:
parent
4087faf1f1
commit
2e4c9720d8
|
@ -31,6 +31,15 @@ end_per_suite(_) ->
|
|||
emqx_mgmt_api_test_util:end_suite().
|
||||
|
||||
t_stats_api(_) ->
|
||||
S = emqx_mgmt_api_test_util:api_path(["stats?aggregate=false"]),
|
||||
{ok, S1} = emqx_mgmt_api_test_util:request_api(get, S),
|
||||
[Stats1] = emqx_json:decode(S1, [return_maps]),
|
||||
SystemStats1 = emqx_mgmt:get_stats(),
|
||||
Fun1 =
|
||||
fun(Key) ->
|
||||
?assertEqual(maps:get(Key, SystemStats1), maps:get(atom_to_binary(Key, utf8), Stats1))
|
||||
end,
|
||||
lists:foreach(Fun1, maps:keys(SystemStats1)),
|
||||
StatsPath = emqx_mgmt_api_test_util:api_path(["stats?aggregate=true"]),
|
||||
SystemStats = emqx_mgmt:get_stats(),
|
||||
{ok, StatsResponse} = emqx_mgmt_api_test_util:request_api(get, StatsPath),
|
||||
|
|
Loading…
Reference in New Issue