diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2020-03-30 21:30:48 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2020-03-30 21:30:48 +0300 |
| commit | 23aa6398d62b01eebb7c31ae859ac2e3d43fa3d2 (patch) | |
| tree | c3b69628934c20f05f61c32ebfbf13520f6f3800 | |
| parent | 41b069c97fdd9dda931da0f38d08a1ace39fdb45 (diff) | |
| download | rabbitmq-server-git-23aa6398d62b01eebb7c31ae859ac2e3d43fa3d2.tar.gz | |
Split the rest of unit_inbroker_non_parallel_SUITE
| -rw-r--r-- | test/unit_connection_tracking_SUITE.erl | 113 | ||||
| -rw-r--r-- | test/unit_stats_and_metrics_SUITE.erl (renamed from test/unit_inbroker_non_parallel_SUITE.erl) | 60 |
2 files changed, 115 insertions, 58 deletions
diff --git a/test/unit_connection_tracking_SUITE.erl b/test/unit_connection_tracking_SUITE.erl new file mode 100644 index 0000000000..de30e4fdf2 --- /dev/null +++ b/test/unit_connection_tracking_SUITE.erl @@ -0,0 +1,113 @@ +%% The contents of this file are subject to the Mozilla Public License +%% Version 1.1 (the "License"); you may not use this file except in +%% compliance with the License. You may obtain a copy of the License at +%% https://www.mozilla.org/MPL/ +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +%% License for the specific language governing rights and limitations +%% under the License. +%% +%% The Original Code is RabbitMQ. +%% +%% The Initial Developer of the Original Code is GoPivotal, Inc. +%% Copyright (c) 2011-2020 VMware, Inc. or its affiliates. All rights reserved. +%% + +-module(unit_connection_tracking_SUITE). + +-include_lib("eunit/include/eunit.hrl"). +-include_lib("common_test/include/ct.hrl"). +-include_lib("eunit/include/eunit.hrl"). +-include_lib("kernel/include/file.hrl"). +-include_lib("amqp_client/include/amqp_client.hrl"). + +-compile(export_all). + +-define(TIMEOUT, 30000). + +all() -> + [ + {group, non_parallel_tests} + ]. + +groups() -> + [ + {non_parallel_tests, [], [ + exchange_count, + queue_count, + connection_count, + connection_lookup + ]} + ]. + +%% ------------------------------------------------------------------- +%% Testsuite setup/teardown. +%% ------------------------------------------------------------------- + +init_per_suite(Config) -> + rabbit_ct_helpers:log_environment(), + rabbit_ct_helpers:run_setup_steps(Config). + +end_per_suite(Config) -> + rabbit_ct_helpers:run_teardown_steps(Config). + +init_per_group(Group, Config) -> + Config1 = rabbit_ct_helpers:set_config(Config, [ + {rmq_nodename_suffix, Group}, + {rmq_nodes_count, 1} + ]), + rabbit_ct_helpers:run_steps(Config1, + rabbit_ct_broker_helpers:setup_steps() ++ + rabbit_ct_client_helpers:setup_steps()). + +end_per_group(_Group, Config) -> + rabbit_ct_helpers:run_steps(Config, + rabbit_ct_client_helpers:teardown_steps() ++ + rabbit_ct_broker_helpers:teardown_steps()). + +init_per_testcase(Testcase, Config) -> + rabbit_ct_helpers:testcase_started(Config, Testcase). + +end_per_testcase(Testcase, Config) -> + rabbit_ct_helpers:testcase_finished(Config, Testcase). + + +%% --------------------------------------------------------------------------- +%% Count functions for management only API purposes +%% --------------------------------------------------------------------------- + +exchange_count(Config) -> + %% Default exchanges == 7 + ?assertEqual(7, rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_exchange, count, [])). + +queue_count(Config) -> + Conn = rabbit_ct_client_helpers:open_connection(Config, 0), + {ok, Ch} = amqp_connection:open_channel(Conn), + amqp_channel:call(Ch, #'queue.declare'{ queue = <<"my-queue">> }), + + ?assertEqual(1, rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_amqqueue, count, [])), + + amqp_channel:call(Ch, #'queue.delete'{ queue = <<"my-queue">> }), + rabbit_ct_client_helpers:close_channel(Ch), + rabbit_ct_client_helpers:close_connection(Conn), + ok. + +connection_count(Config) -> + Conn = rabbit_ct_client_helpers:open_connection(Config, 0), + + ?assertEqual(1, rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_connection_tracking, count, [])), + + rabbit_ct_client_helpers:close_connection(Conn), + ok. + +connection_lookup(Config) -> + Conn = rabbit_ct_client_helpers:open_connection(Config, 0), + + [Connection] = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_connection_tracking, list, []), + ?assertMatch(Connection, rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_connection_tracking, + lookup, + [Connection#tracked_connection.name])), + + rabbit_ct_client_helpers:close_connection(Conn), + ok. diff --git a/test/unit_inbroker_non_parallel_SUITE.erl b/test/unit_stats_and_metrics_SUITE.erl index 6ea6957205..67a26f700b 100644 --- a/test/unit_inbroker_non_parallel_SUITE.erl +++ b/test/unit_stats_and_metrics_SUITE.erl @@ -14,7 +14,7 @@ %% Copyright (c) 2011-2020 VMware, Inc. or its affiliates. All rights reserved. %% --module(unit_inbroker_non_parallel_SUITE). +-module(unit_stats_and_metrics_SUITE). -include_lib("eunit/include/eunit.hrl"). -include_lib("common_test/include/ct.hrl"). @@ -35,11 +35,7 @@ groups() -> [ {non_parallel_tests, [], [ channel_statistics, - head_message_timestamp_statistics, - exchange_count, - queue_count, - connection_count, - connection_lookup + head_message_timestamp_statistics ]} ]. @@ -277,55 +273,3 @@ test_spawn() -> after ?TIMEOUT -> throw(failed_to_receive_channel_open_ok) end, {Writer, Ch}. - -%% --------------------------------------------------------------------------- -%% Count functions for management only API purposes -%% --------------------------------------------------------------------------- -exchange_count(Config) -> - %% Default exchanges == 7 - ?assertEqual(7, rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_exchange, count, [])). - -queue_count(Config) -> - Conn = rabbit_ct_client_helpers:open_connection(Config, 0), - {ok, Ch} = amqp_connection:open_channel(Conn), - amqp_channel:call(Ch, #'queue.declare'{ queue = <<"my-queue">> }), - - ?assertEqual(1, rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_amqqueue, count, [])), - - amqp_channel:call(Ch, #'queue.delete'{ queue = <<"my-queue">> }), - rabbit_ct_client_helpers:close_channel(Ch), - rabbit_ct_client_helpers:close_connection(Conn), - ok. - -connection_count(Config) -> - Conn = rabbit_ct_client_helpers:open_connection(Config, 0), - - ?assertEqual(1, rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_connection_tracking, count, [])), - - rabbit_ct_client_helpers:close_connection(Conn), - ok. - -connection_lookup(Config) -> - Conn = rabbit_ct_client_helpers:open_connection(Config, 0), - - [Connection] = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_connection_tracking, list, []), - ?assertMatch(Connection, rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_connection_tracking, - lookup, - [Connection#tracked_connection.name])), - - rabbit_ct_client_helpers:close_connection(Conn), - ok. - -%% --------------------------------------------------------------------------- -%% rabbitmqctl helpers. -%% --------------------------------------------------------------------------- - -default_options() -> [{"-p", "/"}, {"-q", "false"}]. - -expand_options(As, Bs) -> - lists:foldl(fun({K, _}=A, R) -> - case proplists:is_defined(K, R) of - true -> R; - false -> [A | R] - end - end, Bs, As). |
