summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Klishin <mklishin@pivotal.io>2016-11-10 18:07:14 +0300
committerMichael Klishin <mklishin@pivotal.io>2016-11-10 18:07:14 +0300
commit16b46a3ac0de91b75291eb48d63f0bbca8abc913 (patch)
tree101e0855cf0715ac1cfb38a0530d90b720699fcd /test
parent8defad6fb4620ad61a96c1459b85ebddfdc7d763 (diff)
downloadrabbitmq-server-git-16b46a3ac0de91b75291eb48d63f0bbca8abc913.tar.gz
Skip DNS peer discovery backend tests in offline environments
Diffstat (limited to 'test')
-rw-r--r--test/peer_discovery_dns_SUITE.erl33
1 files changed, 25 insertions, 8 deletions
diff --git a/test/peer_discovery_dns_SUITE.erl b/test/peer_discovery_dns_SUITE.erl
index 13bf93ca86..80bb2f8de6 100644
--- a/test/peer_discovery_dns_SUITE.erl
+++ b/test/peer_discovery_dns_SUITE.erl
@@ -48,6 +48,14 @@ suite() ->
%% Testsuite setup/teardown.
%% -------------------------------------------------------------------
+%% peer_discovery.tests.rabbitmq.net used in the tests below
+%% returns three A records two of which fail our resolution process:
+%%
+%% * One does not resolve to a [typically] non-reachable IP
+%% * One does not support reverse lookup queries
+
+-define(DISCOVERY_ENDPOINT, "peer_discovery.tests.rabbitmq.net").
+
init_per_suite(Config) ->
rabbit_ct_helpers:log_environment(),
rabbit_ct_helpers:run_setup_steps(Config).
@@ -55,19 +63,28 @@ init_per_suite(Config) ->
end_per_suite(Config) ->
rabbit_ct_helpers:run_teardown_steps(Config).
+init_per_testcase(_Testcase, Config) ->
+ %% TODO: support IPv6-only environments
+ case inet_res:lookup(?DISCOVERY_ENDPOINT, in, a) of
+ [] ->
+ {skip, "pre-configured *.rabbitmq.net record does not resolve, skipping"};
+ [_ | _] ->
+ Config
+ end.
+
+end_per_testcase(_Testcase, Config) ->
+ case inet_res:lookup(?DISCOVERY_ENDPOINT, in, a) of
+ [] ->
+ {skip, "pre-configured *.rabbitmq.net record does not resolve, skipping"};
+ [_ | _] ->
+ Config
+ end.
+
%% -------------------------------------------------------------------
%% Test cases
%% -------------------------------------------------------------------
-%% peer_discovery.tests.rabbitmq.net used in the tests below
-%% returns three A records two of which fail our resolution process:
-%%
-%% * One does not resolve to a [typically] non-reachable IP
-%% * One does not support reverse lookup queries
-
--define(DISCOVERY_ENDPOINT, "peer_discovery.tests.rabbitmq.net").
-
hostname_discovery_with_long_node_names(_) ->
Result = rabbit_peer_discovery_dns:discover_hostnames(?DISCOVERY_ENDPOINT, true),
?assertEqual(["www.rabbitmq.com"], Result).