Merge branch 'stable'
This commit is contained in:
commit
07ccb1054d
|
|
@ -2885,10 +2885,13 @@ channel_statistics1(_Config) ->
|
||||||
dummy_event_receiver:start(self(), [node()], [channel_stats]),
|
dummy_event_receiver:start(self(), [node()], [channel_stats]),
|
||||||
|
|
||||||
%% Check stats empty
|
%% Check stats empty
|
||||||
Event = test_ch_statistics_receive_event(Ch, fun (_) -> true end),
|
Check1 = fun() ->
|
||||||
[] = proplists:get_value(channel_queue_stats, Event),
|
[] = ets:match(channel_queue_metrics, {Ch, QRes}),
|
||||||
[] = proplists:get_value(channel_exchange_stats, Event),
|
[] = ets:match(channel_exchange_metrics, {Ch, X}),
|
||||||
[] = proplists:get_value(channel_queue_exchange_stats, Event),
|
[] = ets:match(channel_queue_exchange_metrics,
|
||||||
|
{Ch, {QRes, X}})
|
||||||
|
end,
|
||||||
|
test_ch_metrics(Check1, ?TIMEOUT),
|
||||||
|
|
||||||
%% Publish and get a message
|
%% Publish and get a message
|
||||||
rabbit_channel:do(Ch, #'basic.publish'{exchange = <<"">>,
|
rabbit_channel:do(Ch, #'basic.publish'{exchange = <<"">>,
|
||||||
|
|
@ -2897,46 +2900,44 @@ channel_statistics1(_Config) ->
|
||||||
rabbit_channel:do(Ch, #'basic.get'{queue = QName}),
|
rabbit_channel:do(Ch, #'basic.get'{queue = QName}),
|
||||||
|
|
||||||
%% Check the stats reflect that
|
%% Check the stats reflect that
|
||||||
Event2 = test_ch_statistics_receive_event(
|
Check2 = fun() ->
|
||||||
Ch,
|
[{{Ch, QRes}, 1, 0, 0, 0, 0, 0}] = ets:lookup(
|
||||||
fun (E) ->
|
channel_queue_metrics,
|
||||||
length(proplists:get_value(
|
{Ch, QRes}),
|
||||||
channel_queue_exchange_stats, E)) > 0
|
[{{Ch, X}, 1, 0, 0}] = ets:lookup(
|
||||||
end),
|
channel_exchange_metrics,
|
||||||
[{QRes, [{get,1}]}] = proplists:get_value(channel_queue_stats, Event2),
|
{Ch, X}),
|
||||||
[{X,[{publish,1}]}] = proplists:get_value(channel_exchange_stats, Event2),
|
[{{Ch, {QRes, X}}, 1}] = ets:lookup(
|
||||||
[{{QRes,X},[{publish,1}]}] =
|
channel_queue_exchange_metrics,
|
||||||
proplists:get_value(channel_queue_exchange_stats, Event2),
|
{Ch, {QRes, X}})
|
||||||
|
end,
|
||||||
|
test_ch_metrics(Check2, ?TIMEOUT),
|
||||||
|
|
||||||
%% Check the stats remove stuff on queue deletion
|
%% Check the stats remove stuff on queue deletion
|
||||||
rabbit_channel:do(Ch, #'queue.delete'{queue = QName}),
|
rabbit_channel:do(Ch, #'queue.delete'{queue = QName}),
|
||||||
Event3 = test_ch_statistics_receive_event(
|
Check3 = fun() ->
|
||||||
Ch,
|
[] = ets:lookup(channel_queue_metrics, {Ch, QRes}),
|
||||||
fun (E) ->
|
[{{Ch, X}, 1, 0, 0}] = ets:lookup(
|
||||||
length(proplists:get_value(
|
channel_exchange_metrics,
|
||||||
channel_queue_exchange_stats, E)) == 0
|
{Ch, X}),
|
||||||
end),
|
[] = ets:lookup(channel_queue_exchange_metrics,
|
||||||
|
{Ch, {QRes, X}})
|
||||||
[] = proplists:get_value(channel_queue_stats, Event3),
|
end,
|
||||||
[{X,[{publish,1}]}] = proplists:get_value(channel_exchange_stats, Event3),
|
test_ch_metrics(Check3, ?TIMEOUT),
|
||||||
[] = proplists:get_value(channel_queue_exchange_stats, Event3),
|
|
||||||
|
|
||||||
rabbit_channel:shutdown(Ch),
|
rabbit_channel:shutdown(Ch),
|
||||||
dummy_event_receiver:stop(),
|
dummy_event_receiver:stop(),
|
||||||
passed.
|
passed.
|
||||||
|
|
||||||
test_ch_statistics_receive_event(Ch, Matcher) ->
|
test_ch_metrics(Fun, Timeout) when Timeout =< 0 ->
|
||||||
rabbit_channel:flush(Ch),
|
Fun();
|
||||||
Ch ! emit_stats,
|
test_ch_metrics(Fun, Timeout) ->
|
||||||
test_ch_statistics_receive_event1(Ch, Matcher).
|
try
|
||||||
|
Fun()
|
||||||
test_ch_statistics_receive_event1(Ch, Matcher) ->
|
catch
|
||||||
receive #event{type = channel_stats, props = Props} ->
|
_:{badmatch, _} ->
|
||||||
case Matcher(Props) of
|
timer:sleep(1000),
|
||||||
true -> Props;
|
test_ch_metrics(Fun, Timeout - 1000)
|
||||||
_ -> test_ch_statistics_receive_event1(Ch, Matcher)
|
|
||||||
end
|
|
||||||
after ?TIMEOUT -> throw(failed_to_receive_event)
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
head_message_timestamp_statistics(Config) ->
|
head_message_timestamp_statistics(Config) ->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue