diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2017-05-08 18:01:10 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2017-05-08 18:01:10 +0300 |
| commit | 7132664520b09cf6e15dc95e91ce73eedd4407e4 (patch) | |
| tree | 34d0b51dabde73dbde00e2b928e4b52450eaaee8 /test | |
| parent | d6fa2093375ac295b765261e34213de4a61960b9 (diff) | |
| parent | 0bd4b78b3540c65648563714239d2a270c9816a4 (diff) | |
| download | rabbitmq-server-git-7132664520b09cf6e15dc95e91ce73eedd4407e4.tar.gz | |
Merge branch 'master' into rabbitmq-server-1146-full
Conflicts:
Makefile
Diffstat (limited to 'test')
| -rw-r--r-- | test/peer_discovery_dns_SUITE.erl | 34 | ||||
| -rw-r--r-- | test/rabbitmqctl_shutdown_SUITE.erl | 21 | ||||
| -rw-r--r-- | test/unit_inbroker_non_parallel_SUITE.erl | 32 |
3 files changed, 58 insertions, 29 deletions
diff --git a/test/peer_discovery_dns_SUITE.erl b/test/peer_discovery_dns_SUITE.erl index 687569890f..7deb38ba97 100644 --- a/test/peer_discovery_dns_SUITE.erl +++ b/test/peer_discovery_dns_SUITE.erl @@ -33,7 +33,8 @@ groups() -> hostname_discovery_with_long_node_names, hostname_discovery_with_short_node_names, node_discovery_with_long_node_names, - node_discovery_with_short_node_names + node_discovery_with_short_node_names, + test_aaaa_record_hostname_discovery ]} ]. @@ -54,7 +55,9 @@ suite() -> %% * 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"). +-define(DISCOVERY_ENDPOINT_RECORD_A, "peer_discovery.tests.rabbitmq.net"). + +-define(DISCOVERY_ENDPOINT_RECORD_AAAA, "www.v6.facebook.com"). init_per_suite(Config) -> rabbit_ct_helpers:log_environment(), @@ -63,17 +66,26 @@ init_per_suite(Config) -> end_per_suite(Config) -> rabbit_ct_helpers:run_teardown_steps(Config). + +init_per_testcase(test_aaaa_record, Config) -> + case inet_res:lookup(?DISCOVERY_ENDPOINT_RECORD_AAAA, in, aaaa) of + [] -> + {skip, "pre-configured AAAA record does not resolve, skipping"}; + [_ | _] -> + Config + end; + init_per_testcase(_Testcase, Config) -> - %% TODO: support IPv6-only environments - case inet_res:lookup(?DISCOVERY_ENDPOINT, in, a) of + case inet_res:lookup(?DISCOVERY_ENDPOINT_RECORD_A, 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 + case inet_res:lookup(?DISCOVERY_ENDPOINT_RECORD_A, in, a) of [] -> {skip, "pre-configured *.rabbitmq.net record does not resolve, skipping"}; [_ | _] -> @@ -85,18 +97,22 @@ end_per_testcase(_Testcase, Config) -> %% Test cases %% ------------------------------------------------------------------- +test_aaaa_record_hostname_discovery(_) -> + Result = rabbit_peer_discovery_dns:discover_hostnames(?DISCOVERY_ENDPOINT_RECORD_AAAA, true), + ?assert(string:str(lists:flatten(Result), "facebook.com") > 0). + hostname_discovery_with_long_node_names(_) -> - Result = rabbit_peer_discovery_dns:discover_hostnames(?DISCOVERY_ENDPOINT, true), + Result = rabbit_peer_discovery_dns:discover_hostnames(?DISCOVERY_ENDPOINT_RECORD_A, true), ?assert(lists:member("www.rabbitmq.com", Result)). hostname_discovery_with_short_node_names(_) -> - Result = rabbit_peer_discovery_dns:discover_hostnames(?DISCOVERY_ENDPOINT, false), + Result = rabbit_peer_discovery_dns:discover_hostnames(?DISCOVERY_ENDPOINT_RECORD_A, false), ?assert(lists:member("www", Result)). node_discovery_with_long_node_names(_) -> - Result = rabbit_peer_discovery_dns:discover_nodes(?DISCOVERY_ENDPOINT, true), + Result = rabbit_peer_discovery_dns:discover_nodes(?DISCOVERY_ENDPOINT_RECORD_A, true), ?assert(lists:member('ct_rabbit@www.rabbitmq.com', Result)). node_discovery_with_short_node_names(_) -> - Result = rabbit_peer_discovery_dns:discover_nodes(?DISCOVERY_ENDPOINT, false), + Result = rabbit_peer_discovery_dns:discover_nodes(?DISCOVERY_ENDPOINT_RECORD_A, false), ?assert(lists:member(ct_rabbit@www, Result)). diff --git a/test/rabbitmqctl_shutdown_SUITE.erl b/test/rabbitmqctl_shutdown_SUITE.erl index fa04dc6504..25cc2fdef8 100644 --- a/test/rabbitmqctl_shutdown_SUITE.erl +++ b/test/rabbitmqctl_shutdown_SUITE.erl @@ -29,8 +29,7 @@ all() -> groups() -> [ {running_node, [], [ - successful_shutdown, - error_during_shutdown + successful_shutdown ]}, {non_running_node, [], [ nothing_to_shutdown @@ -91,16 +90,6 @@ successful_shutdown(Config) -> false = erlang_pid_is_running(Pid), false = node_is_running(Node). -error_during_shutdown(Config) -> - Node = ?config(node, Config), - ok = rabbit_ct_broker_helpers:control_action(stop_app, Node, []), - ok = rpc:call(Node, application, unload, [os_mon]), - - {badrpc, - {'EXIT', { - {error, {badmatch, {error,{edge,{bad_vertex,os_mon},os_mon,rabbit}}}}, - _}}} = shutdown_error(Node). - nothing_to_shutdown(Config) -> Node = ?config(node, Config), @@ -119,14 +108,6 @@ erlang_pid_is_running(Pid) -> node_is_running(Node) -> net_adm:ping(Node) == pong. -shutdown_error(Node) -> - %% Start a command - {stream, Stream} = rabbit_ct_broker_helpers:control_action(shutdown, Node, []), - %% Execute command steps. The last one should be error - Lines = 'Elixir.Enum':to_list(Stream), - {error, Err} = lists:last(Lines), - Err. - shutdown_ok(Node) -> %% Start a command {stream, Stream} = rabbit_ct_broker_helpers:control_action(shutdown, Node, []), diff --git a/test/unit_inbroker_non_parallel_SUITE.erl b/test/unit_inbroker_non_parallel_SUITE.erl index 93f107de6b..2af6368f34 100644 --- a/test/unit_inbroker_non_parallel_SUITE.erl +++ b/test/unit_inbroker_non_parallel_SUITE.erl @@ -35,6 +35,7 @@ groups() -> app_management, %% Restart RabbitMQ. channel_statistics, %% Expect specific statistics. disk_monitor, %% Replace rabbit_misc module. + disk_monitor_enable, file_handle_cache, %% Change FHC limit. head_message_timestamp_statistics, %% Expect specific statistics. log_management, %% Check log files. @@ -631,6 +632,37 @@ disk_monitor1(_Config) -> meck:unload(rabbit_misc), passed. +disk_monitor_enable(Config) -> + passed = rabbit_ct_broker_helpers:rpc(Config, 0, + ?MODULE, disk_monitor_enable1, [Config]). + +disk_monitor_enable1(_Config) -> + case os:type() of + {unix, _} -> + disk_monitor_enable1(); + _ -> + %% skip windows testing + skipped + end. + +disk_monitor_enable1() -> + ok = meck:new(rabbit_misc, [passthrough]), + ok = meck:expect(rabbit_misc, os_cmd, fun(_) -> "\n" end), + application:set_env(rabbit, disk_monitor_failure_retries, 20000), + application:set_env(rabbit, disk_monitor_failure_retry_interval, 100), + ok = rabbit_sup:stop_child(rabbit_disk_monitor_sup), + ok = rabbit_sup:start_delayed_restartable_child(rabbit_disk_monitor, [1000]), + undefined = rabbit_disk_monitor:get_disk_free(), + Cmd = "Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on\n/dev/disk1 975798272 234783364 740758908 25% 58759839 185189727 24% /\n", + ok = meck:expect(rabbit_misc, os_cmd, fun(_) -> Cmd end), + timer:sleep(1000), + Bytes = 740758908 * 1024, + Bytes = rabbit_disk_monitor:get_disk_free(), + meck:unload(rabbit_misc), + application:set_env(rabbit, disk_monitor_failure_retries, 10), + application:set_env(rabbit, disk_monitor_failure_retry_interval, 120000), + passed. + %% --------------------------------------------------------------------------- %% rabbitmqctl helpers. %% --------------------------------------------------------------------------- |
