Merge pull request #2921 from emqx/ct-metrics
Add test cases for new/1, all/0 functions
This commit is contained in:
commit
9fed1667bb
|
@ -24,6 +24,30 @@
|
||||||
|
|
||||||
all() -> emqx_ct:all(?MODULE).
|
all() -> emqx_ct:all(?MODULE).
|
||||||
|
|
||||||
|
t_new(_) ->
|
||||||
|
with_metrics_server(
|
||||||
|
fun() ->
|
||||||
|
ok = emqx_metrics:new('metrics.test'),
|
||||||
|
0 = emqx_metrics:val('metrics.test'),
|
||||||
|
ok = emqx_metrics:inc('metrics.test'),
|
||||||
|
1 = emqx_metrics:val('metrics.test'),
|
||||||
|
ok = emqx_metrics:new(counter, 'metrics.test.cnt'),
|
||||||
|
0 = emqx_metrics:val('metrics.test.cnt'),
|
||||||
|
ok = emqx_metrics:inc('metrics.test.cnt'),
|
||||||
|
1 = emqx_metrics:val('metrics.test.cnt'),
|
||||||
|
ok = emqx_metrics:new(gauge, 'metrics.test.total'),
|
||||||
|
0 = emqx_metrics:val('metrics.test.total'),
|
||||||
|
ok = emqx_metrics:inc('metrics.test.total'),
|
||||||
|
1 = emqx_metrics:val('metrics.test.total')
|
||||||
|
end).
|
||||||
|
|
||||||
|
t_all(_) ->
|
||||||
|
with_metrics_server(
|
||||||
|
fun() ->
|
||||||
|
Metrics = emqx_metrics:all(),
|
||||||
|
?assert(length(Metrics) > 50)
|
||||||
|
end).
|
||||||
|
|
||||||
t_inc_dec(_) ->
|
t_inc_dec(_) ->
|
||||||
with_metrics_server(
|
with_metrics_server(
|
||||||
fun() ->
|
fun() ->
|
||||||
|
|
Loading…
Reference in New Issue