style: format other applications
This commit is contained in:
parent
0a16c9fabf
commit
3716ee60fb
|
@ -120,21 +120,45 @@ t_listener_authenticator_import_users(_) ->
|
||||||
test_authenticator_import_users(["listeners", ?TCP_DEFAULT]).
|
test_authenticator_import_users(["listeners", ?TCP_DEFAULT]).
|
||||||
|
|
||||||
t_aggregate_metrics(_) ->
|
t_aggregate_metrics(_) ->
|
||||||
Metrics = #{ 'emqx@node1.emqx.io' => #{metrics =>
|
Metrics = #{
|
||||||
#{failed => 0,matched => 1,rate => 0.0,
|
'emqx@node1.emqx.io' => #{
|
||||||
rate_last5m => 0.0,rate_max => 0.1,
|
metrics =>
|
||||||
success => 1}
|
#{
|
||||||
},
|
failed => 0,
|
||||||
'emqx@node2.emqx.io' => #{metrics =>
|
matched => 1,
|
||||||
#{failed => 0,matched => 1,rate => 0.0,
|
rate => 0.0,
|
||||||
rate_last5m => 0.0,rate_max => 0.1,
|
rate_last5m => 0.0,
|
||||||
success => 1}
|
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)),
|
Res = emqx_authn_api:aggregate_metrics(maps:values(Metrics)),
|
||||||
?assertEqual(#{metrics =>
|
?assertEqual(
|
||||||
#{failed => 0,matched => 2,rate => 0.0,rate_last5m => 0.0,
|
#{
|
||||||
rate_max => 0.2,success => 2}}, Res).
|
metrics =>
|
||||||
|
#{
|
||||||
|
failed => 0,
|
||||||
|
matched => 2,
|
||||||
|
rate => 0.0,
|
||||||
|
rate_last5m => 0.0,
|
||||||
|
rate_max => 0.2,
|
||||||
|
success => 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Res
|
||||||
|
).
|
||||||
|
|
||||||
test_authenticators(PathPrefix) ->
|
test_authenticators(PathPrefix) ->
|
||||||
ValidConfig = emqx_authn_test_lib:http_example(),
|
ValidConfig = emqx_authn_test_lib:http_example(),
|
||||||
|
|
|
@ -449,21 +449,45 @@ t_move_source(_) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
t_aggregate_metrics(_) ->
|
t_aggregate_metrics(_) ->
|
||||||
Metrics = #{ 'emqx@node1.emqx.io' => #{metrics =>
|
Metrics = #{
|
||||||
#{failed => 0,matched => 1,rate => 0.0,
|
'emqx@node1.emqx.io' => #{
|
||||||
rate_last5m => 0.0,rate_max => 0.1,
|
metrics =>
|
||||||
success => 1}
|
#{
|
||||||
},
|
failed => 0,
|
||||||
'emqx@node2.emqx.io' => #{metrics =>
|
matched => 1,
|
||||||
#{failed => 0,matched => 1,rate => 0.0,
|
rate => 0.0,
|
||||||
rate_last5m => 0.0,rate_max => 0.1,
|
rate_last5m => 0.0,
|
||||||
success => 1}
|
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)),
|
Res = emqx_authn_api:aggregate_metrics(maps:values(Metrics)),
|
||||||
?assertEqual(#{metrics =>
|
?assertEqual(
|
||||||
#{failed => 0,matched => 2,rate => 0.0,rate_last5m => 0.0,
|
#{
|
||||||
rate_max => 0.2,success => 2}}, Res).
|
metrics =>
|
||||||
|
#{
|
||||||
|
failed => 0,
|
||||||
|
matched => 2,
|
||||||
|
rate => 0.0,
|
||||||
|
rate_last5m => 0.0,
|
||||||
|
rate_max => 0.2,
|
||||||
|
success => 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Res
|
||||||
|
).
|
||||||
|
|
||||||
get_sources(Result) ->
|
get_sources(Result) ->
|
||||||
maps:get(<<"sources">>, jsx:decode(Result), []).
|
maps:get(<<"sources">>, jsx:decode(Result), []).
|
||||||
|
|
Loading…
Reference in New Issue