Include the metric type in it's name.
[beam_stats.git] / test / beam_stats_consumer_statsd_SUITE.erl
1 -module(beam_stats_consumer_statsd_SUITE).
2
3 -include_lib("beam_stats/include/beam_stats.hrl").
4
5 -export(
6 [ all/0
7 , groups/0
8 ]).
9
10 %% Test cases
11 -export(
12 [ t_send/1
13 ]).
14
15 -define(GROUP, beam_stats_consumer_statsd).
16
17 %% ============================================================================
18 %% Common Test callbacks
19 %% ============================================================================
20
21 all() ->
22 [{group, ?GROUP}].
23
24 groups() ->
25 Tests =
26 [ t_send
27 ],
28 Properties = [],
29 [{?GROUP, Properties, Tests}].
30
31 %% =============================================================================
32 %% Test cases
33 %% =============================================================================
34
35 t_send(_Cfg) ->
36 BEAMStats = #beam_stats
37 { timestamp = {1, 2, 3}
38 , node_id = 'node_foo@host_bar'
39 , memory = [{mem_type_foo, 1}]
40 },
41 ServerPort = 8125,
42 {ok, ServerSocket} = gen_udp:open(ServerPort, [binary, {active, false}]),
43 BEAMStatsQ = queue:in(BEAMStats, queue:new()),
44 Options = [{dst_port, ServerPort}],
45 {_, State1} = beam_stats_consumer_statsd:init(Options),
46 State2 = beam_stats_consumer_statsd:consume(BEAMStatsQ, State1),
47 {} = beam_stats_consumer_statsd:terminate(State2),
48 ResultOfReceive = gen_udp:recv(ServerSocket, 0),
49 ok = gen_udp:close(ServerSocket),
50 {ok, {_, _, Data}} = ResultOfReceive,
51 <<"beam_stats.node_foo_host_bar.memory.mem_type_foo:1|g\n">> = Data.
This page took 0.055552 seconds and 4 git commands to generate.