diff options
author | Michael Klishin <michael@clojurewerkz.org> | 2020-03-16 12:34:26 +0300 |
---|---|---|
committer | Michael Klishin <michael@clojurewerkz.org> | 2020-03-16 12:34:26 +0300 |
commit | 03c6635fdfa8ec40fef8519e6f54107549fc33dc (patch) | |
tree | 1cef642cb03516766c61e1136dcccd606ef9f4a1 | |
parent | 7f71aecadf8cff5076e08273e7bcc79164ee89fc (diff) | |
download | rabbitmq-server-git-03c6635fdfa8ec40fef8519e6f54107549fc33dc.tar.gz |
Integration tess for classic config peer discovery backend
Pair: @dumbbell.
-rw-r--r-- | test/peer_discovery_classic_config_SUITE.erl | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/test/peer_discovery_classic_config_SUITE.erl b/test/peer_discovery_classic_config_SUITE.erl new file mode 100644 index 0000000000..37e1badf31 --- /dev/null +++ b/test/peer_discovery_classic_config_SUITE.erl @@ -0,0 +1,128 @@ +%% 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(peer_discovery_classic_config_SUITE). + +-include_lib("common_test/include/ct.hrl"). +-include_lib("amqp_client/include/amqp_client.hrl"). +-include_lib("eunit/include/eunit.hrl"). + +-import(rabbit_ct_broker_helpers, [ + stop_node/2, reset_node/1, start_node/2, + rewrite_node_config_file/2, cluster_members_online/2 +]). + +-compile(export_all). + +all() -> + [ + {group, non_parallel} + ]. + +groups() -> + [ + {non_parallel, [], [ + successful_discovery + , no_nodes_configured + ]} + ]. + +suite() -> + [ + {timetrap, {minutes, 5}} + ]. + + +%% +%% 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(_, Config) -> + Config. + +end_per_group(_, Config) -> + Config. + +init_per_testcase(Testcase, Config) when Testcase =:= successful_discovery -> + Config1 = rabbit_ct_helpers:testcase_started(Config, Testcase), + + N = 3, + NodeNames = [ + list_to_atom(rabbit_misc:format("~s-~b", [Testcase, I])) + || I <- lists:seq(1, N) + ], + Config2 = rabbit_ct_helpers:set_config(Config1, [ + {rmq_nodename_suffix, Testcase}, + %% note: this must not include the host part + {rmq_nodes_count, NodeNames}, + {rmq_nodes_clustered, false} + ]), + NodeNamesWithHostname = [rabbit_nodes:make({Name, "localhost"}) || Name <- NodeNames], + Config3 = rabbit_ct_helpers:merge_app_env(Config2, + {rabbit, [ + {cluster_nodes, {NodeNamesWithHostname, disc}} + ]}), + rabbit_ct_helpers:run_steps(Config3, + rabbit_ct_broker_helpers:setup_steps() ++ + rabbit_ct_client_helpers:setup_steps()); +init_per_testcase(no_nodes_configured = Testcase, Config) -> + Config1 = rabbit_ct_helpers:testcase_started(Config, Testcase), + Config2 = rabbit_ct_helpers:set_config(Config1, [ + {rmq_nodename_suffix, Testcase}, + {rmq_nodes_count, 2}, + {rmq_nodes_clustered, false} + ]), + Config3 = rabbit_ct_helpers:merge_app_env(Config2, + {rabbit, [ + {cluster_nodes, {[], disc}} + ]}), + rabbit_ct_helpers:run_steps(Config3, + rabbit_ct_broker_helpers:setup_steps() ++ + rabbit_ct_client_helpers:setup_steps()); +init_per_testcase(Testcase, Config) -> + rabbit_ct_helpers:testcase_started(Config, Testcase), + rabbit_ct_helpers:run_steps(Config, + rabbit_ct_broker_helpers:setup_steps() ++ + rabbit_ct_client_helpers:setup_steps()). + + +end_per_testcase(Testcase, Config) -> + Config1 = rabbit_ct_helpers:run_steps(Config, + rabbit_ct_client_helpers:teardown_steps() ++ + rabbit_ct_broker_helpers:teardown_steps()), + rabbit_ct_helpers:testcase_finished(Config1, Testcase). + + +%% +%% Test cases +%% + +successful_discovery(Config) -> + %% note: this will include a "management" node for this suite + ?assert(length(cluster_members_online(Config, 0)) > 2), + ?assert(length(cluster_members_online(Config, 1)) > 2). + +no_nodes_configured(Config) -> + ct:pal("Cluster members online: ~p", [cluster_members_online(Config, 0)]), + ?assert(length(cluster_members_online(Config, 0)) < 2). + |