88
99prometheus_format_test_ () ->
1010 {foreach , fun prometheus_eunit_common :start /0 , fun prometheus_eunit_common :stop /1 , [
11- fun test_registration /1 ,
11+ fun test_registration_as_list /1 ,
12+ fun test_registration_as_map /1 ,
1213 fun test_errors /1 ,
1314 fun test_observe /1 ,
1415 fun test_observe_quantiles /1 ,
@@ -36,7 +37,7 @@ test_merge_logic_when_fetching_value(_) ->
3637 collect_monitors (Monitors ),
3738 [? _assertMatch ({_ , _ , _ }, prometheus_quantile_summary :value (Name ))].
3839
39- test_registration (_ ) ->
40+ test_registration_as_list (_ ) ->
4041 Name = orders_summary ,
4142 SpecWithRegistry = [{name , Name }, {help , " " }, {registry , qwe }],
4243 [
@@ -50,6 +51,20 @@ test_registration(_) ->
5051 )
5152 ].
5253
54+ test_registration_as_map (_ ) ->
55+ Name = orders_summary ,
56+ SpecWithRegistry = #{name => Name , help => " " , registry => qwe },
57+ [
58+ ? _assertEqual (
59+ true ,
60+ prometheus_quantile_summary :declare (SpecWithRegistry )
61+ ),
62+ ? _assertError (
63+ {mf_already_exists , {qwe , Name }, " Consider using declare instead." },
64+ prometheus_quantile_summary :new (SpecWithRegistry )
65+ )
66+ ].
67+
5368test_errors (_ ) ->
5469 prometheus_quantile_summary :new ([{name , db_query_duration }, {labels , [repo ]}, {help , " " }]),
5570 % % basic name/labels/help validations test
0 commit comments