X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=test%2Fbeam_stats_consumer_statsd_SUITE.erl;h=a5b37796503d94367647097f2e4dc375e1d6bbcf;hb=11e1cb97537476ce805262952a5c615000a6cf78;hp=2283ed912c7be5d2aeb2920b618d7a20fe54a171;hpb=8fe744e7d00da9039d59d3551d4f05a0e1b007d2;p=beam_stats.git diff --git a/test/beam_stats_consumer_statsd_SUITE.erl b/test/beam_stats_consumer_statsd_SUITE.erl index 2283ed9..a5b3779 100644 --- a/test/beam_stats_consumer_statsd_SUITE.erl +++ b/test/beam_stats_consumer_statsd_SUITE.erl @@ -38,11 +38,7 @@ groups() -> t_full_cycle(_Cfg) -> meck:new(beam_stats_source), - BEAMStatsExpected = meck_expect_beam_stats(), - BEAMStatsComputed = beam_stats_state:export(beam_stats_state:new()), - ct:log("BEAMStatsExpected: ~p~n", [BEAMStatsExpected]), - ct:log("BEAMStatsComputed: ~p~n", [BEAMStatsComputed]), - BEAMStatsExpected = BEAMStatsComputed, + _BEAMStatsExpected = meck_expect_beam_stats(), {ok,[hope,beam_stats]} = application:ensure_all_started(beam_stats), ct:log("beam_stats started~n"), @@ -64,6 +60,7 @@ t_full_cycle(_Cfg) -> [ {io_bytes_in , 6} , {io_bytes_out , 14} , {context_switches , 10} + , {reductions , 18} ] ), ct:log("meck_expect_beam_stats ok~n"), @@ -101,10 +98,10 @@ t_full_cycle(_Cfg) -> , <<"beam_stats_v0.node_foo_host_bar.memory.mem_type_foo:1|g">> , <<"beam_stats_v0.node_foo_host_bar.memory.mem_type_bar:2|g">> , <<"beam_stats_v0.node_foo_host_bar.memory.mem_type_baz:3|g">> - , <<"beam_stats_v0.node_foo_host_bar.ets_table.size.foo.foo:5|g">> - , <<"beam_stats_v0.node_foo_host_bar.ets_table.memory.foo.foo:40|g">> - , <<"beam_stats_v0.node_foo_host_bar.ets_table.size.bar.37:8|g">> - , <<"beam_stats_v0.node_foo_host_bar.ets_table.memory.bar.37:64|g">> + , <<"beam_stats_v0.node_foo_host_bar.ets_table.size.foo.NAMED:5|g">> + , <<"beam_stats_v0.node_foo_host_bar.ets_table.memory.foo.NAMED:40|g">> + , <<"beam_stats_v0.node_foo_host_bar.ets_table.size.bar.TID:16|g">> + , <<"beam_stats_v0.node_foo_host_bar.ets_table.memory.bar.TID:128|g">> % Processes totals , <<"beam_stats_v0.node_foo_host_bar.processes_count_all:4|g">> @@ -154,6 +151,7 @@ meck_expect_beam_stats(Overrides) -> IOBytesIn = hope_kv_list:get(Overrides, io_bytes_in , 3), IOBytesOut = hope_kv_list:get(Overrides, io_bytes_out, 7), ContextSwitches = hope_kv_list:get(Overrides, context_switches, 5), + Reductions = hope_kv_list:get(Overrides, reductions, 9), Pid0 = list_to_pid("<0.0.0>"), Pid1 = list_to_pid("<0.1.0>"), Pid2 = list_to_pid("<0.2.0>"), @@ -247,13 +245,20 @@ meck_expect_beam_stats(Overrides) -> , size = 5 , memory = 40 }, - ETSTableStatsBar = + ETSTableStatsBarA = #beam_stats_ets_table { id = 37 , name = bar , size = 8 , memory = 64 }, + ETSTableStatsBarB = + #beam_stats_ets_table + { id = 38 + , name = bar + , size = 8 + , memory = 64 + }, meck:expect(beam_stats_source, erlang_memory, fun () -> [{mem_type_foo, 1}, {mem_type_bar, 2}, {mem_type_baz, 3}] end), meck:expect(beam_stats_source, erlang_node, @@ -263,21 +268,26 @@ meck_expect_beam_stats(Overrides) -> meck:expect(beam_stats_source, erlang_statistics, fun (io ) -> {{input, IOBytesIn}, {output, IOBytesOut}} ; (context_switches) -> {ContextSwitches, 0} - ; (reductions ) -> {0, 9} % 1st element is unused + ; (reductions ) -> {Reductions, undefined} % 2nd element is unused ; (run_queue ) -> 17 end ), meck:expect(beam_stats_source, ets_all, - fun () -> [foo, 37] end), + fun () -> [foo, 37, 38] end), meck:expect(beam_stats_source, erlang_system_info, fun (wordsize) -> 8 end), meck:expect(beam_stats_source, ets_info, fun (foo, memory) -> 5 ; (foo, name ) -> foo ; (foo, size ) -> 5 + ; (37 , memory) -> 8 ; (37 , name ) -> bar ; (37 , size ) -> 8 + + ; (38 , memory) -> 8 + ; (38 , name ) -> bar + ; (38 , size ) -> 8 end ), meck:expect(beam_stats_source, erlang_processes, @@ -348,6 +358,6 @@ meck_expect_beam_stats(Overrides) -> , context_switches = ContextSwitches , reductions = 9 , run_queue = 17 - , ets = [ETSTableStatsFoo, ETSTableStatsBar] + , ets = [ETSTableStatsFoo, ETSTableStatsBarA, ETSTableStatsBarB] , processes = Processes }.