From 3716ee60fba0aa6015fb60e25b842d75869a7855 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Mon, 25 Apr 2022 11:22:59 -0300 Subject: [PATCH] style: format other applications --- apps/emqx_authn/test/emqx_authn_api_SUITE.erl | 52 ++++++++++++++----- .../test/emqx_authz_api_sources_SUITE.erl | 52 ++++++++++++++----- 2 files changed, 76 insertions(+), 28 deletions(-) diff --git a/apps/emqx_authn/test/emqx_authn_api_SUITE.erl b/apps/emqx_authn/test/emqx_authn_api_SUITE.erl index d7342185a..21b53bb1f 100644 --- a/apps/emqx_authn/test/emqx_authn_api_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_api_SUITE.erl @@ -120,21 +120,45 @@ t_listener_authenticator_import_users(_) -> test_authenticator_import_users(["listeners", ?TCP_DEFAULT]). t_aggregate_metrics(_) -> - Metrics = #{ 'emqx@node1.emqx.io' => #{metrics => - #{failed => 0,matched => 1,rate => 0.0, - rate_last5m => 0.0,rate_max => 0.1, - success => 1} - }, - 'emqx@node2.emqx.io' => #{metrics => - #{failed => 0,matched => 1,rate => 0.0, - rate_last5m => 0.0,rate_max => 0.1, - success => 1} - } - }, + Metrics = #{ + 'emqx@node1.emqx.io' => #{ + metrics => + #{ + failed => 0, + matched => 1, + rate => 0.0, + rate_last5m => 0.0, + rate_max => 0.1, + success => 1 + } + }, + 'emqx@node2.emqx.io' => #{ + metrics => + #{ + failed => 0, + matched => 1, + rate => 0.0, + rate_last5m => 0.0, + rate_max => 0.1, + success => 1 + } + } + }, Res = emqx_authn_api:aggregate_metrics(maps:values(Metrics)), - ?assertEqual(#{metrics => - #{failed => 0,matched => 2,rate => 0.0,rate_last5m => 0.0, - rate_max => 0.2,success => 2}}, Res). + ?assertEqual( + #{ + metrics => + #{ + failed => 0, + matched => 2, + rate => 0.0, + rate_last5m => 0.0, + rate_max => 0.2, + success => 2 + } + }, + Res + ). test_authenticators(PathPrefix) -> ValidConfig = emqx_authn_test_lib:http_example(), diff --git a/apps/emqx_authz/test/emqx_authz_api_sources_SUITE.erl b/apps/emqx_authz/test/emqx_authz_api_sources_SUITE.erl index a41f98d27..308e67d53 100644 --- a/apps/emqx_authz/test/emqx_authz_api_sources_SUITE.erl +++ b/apps/emqx_authz/test/emqx_authz_api_sources_SUITE.erl @@ -449,21 +449,45 @@ t_move_source(_) -> ok. t_aggregate_metrics(_) -> - Metrics = #{ 'emqx@node1.emqx.io' => #{metrics => - #{failed => 0,matched => 1,rate => 0.0, - rate_last5m => 0.0,rate_max => 0.1, - success => 1} - }, - 'emqx@node2.emqx.io' => #{metrics => - #{failed => 0,matched => 1,rate => 0.0, - rate_last5m => 0.0,rate_max => 0.1, - success => 1} - } - }, + Metrics = #{ + 'emqx@node1.emqx.io' => #{ + metrics => + #{ + failed => 0, + matched => 1, + rate => 0.0, + rate_last5m => 0.0, + rate_max => 0.1, + success => 1 + } + }, + 'emqx@node2.emqx.io' => #{ + metrics => + #{ + failed => 0, + matched => 1, + rate => 0.0, + rate_last5m => 0.0, + rate_max => 0.1, + success => 1 + } + } + }, Res = emqx_authn_api:aggregate_metrics(maps:values(Metrics)), - ?assertEqual(#{metrics => - #{failed => 0,matched => 2,rate => 0.0,rate_last5m => 0.0, - rate_max => 0.2,success => 2}}, Res). + ?assertEqual( + #{ + metrics => + #{ + failed => 0, + matched => 2, + rate => 0.0, + rate_last5m => 0.0, + rate_max => 0.2, + success => 2 + } + }, + Res + ). get_sources(Result) -> maps:get(<<"sources">>, jsx:decode(Result), []).