Add reductions delta.
[beam_stats.git] / test / beam_stats_consumer_statsd_SUITE.erl
CommitLineData
b0ab6ee2
SK
1-module(beam_stats_consumer_statsd_SUITE).
2
da5f2544
SK
3-include_lib("beam_stats/include/beam_stats.hrl").
4
b0ab6ee2
SK
5-export(
6 [ all/0
7 , groups/0
8 ]).
9
10%% Test cases
11-export(
5681263f 12 [ t_send/1
b0ab6ee2
SK
13 ]).
14
5681263f 15-define(GROUP, beam_stats_consumer_statsd).
b0ab6ee2
SK
16
17%% ============================================================================
18%% Common Test callbacks
19%% ============================================================================
20
21all() ->
22 [{group, ?GROUP}].
23
24groups() ->
25 Tests =
5681263f 26 [ t_send
b0ab6ee2
SK
27 ],
28 Properties = [],
29 [{?GROUP, Properties, Tests}].
30
31%% =============================================================================
32%% Test cases
33%% =============================================================================
34
da5f2544
SK
35t_send(_Cfg) ->
36 BEAMStats = #beam_stats
37 { timestamp = {1, 2, 3}
38 , node_id = 'node_foo@host_bar'
39 , memory = [{mem_type_foo, 1}]
b4e2333f
SK
40 , io_bytes_in = 3
41 , io_bytes_out = 7
3fe887d7 42 , context_switches = 5
142c0796 43 , reductions = 9
da5f2544
SK
44 },
45 ServerPort = 8125,
46 {ok, ServerSocket} = gen_udp:open(ServerPort, [binary, {active, false}]),
47 BEAMStatsQ = queue:in(BEAMStats, queue:new()),
48 Options = [{dst_port, ServerPort}],
49 {_, State1} = beam_stats_consumer_statsd:init(Options),
50 State2 = beam_stats_consumer_statsd:consume(BEAMStatsQ, State1),
51 {} = beam_stats_consumer_statsd:terminate(State2),
52 ResultOfReceive = gen_udp:recv(ServerSocket, 0),
53 ok = gen_udp:close(ServerSocket),
54 {ok, {_, _, Data}} = ResultOfReceive,
b4e2333f
SK
55 << "beam_stats.node_foo_host_bar.io.bytes_in:3|g\n"
56 , "beam_stats.node_foo_host_bar.io.bytes_out:7|g\n"
3fe887d7 57 , "beam_stats.node_foo_host_bar.context_switches:5|g\n"
142c0796 58 , "beam_stats.node_foo_host_bar.reductions:9|g\n"
b4e2333f
SK
59 , "beam_stats.node_foo_host_bar.memory.mem_type_foo:1|g\n"
60 >> = Data.
This page took 0.037864 seconds and 4 git commands to generate.