summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Klishin <michael@novemberain.com>2017-04-12 14:13:25 +0300
committerGitHub <noreply@github.com>2017-04-12 14:13:25 +0300
commitbafb80126c539e8d3c745622fbc5bebe8197439c (patch)
tree08fa32d92229c3d774826bd81e4142343bf4a4e9 /test
parentf0da42683f491b527cd3358c91c9370d8be3d5fd (diff)
parentc340c0d92aeba9f4b89f0e0e81e774393d3677c0 (diff)
downloadrabbitmq-server-git-bafb80126c539e8d3c745622fbc5bebe8197439c.tar.gz
Merge pull request #1179 from rabbitmq/rabbitmq-server-1178
Re-enable disk_monitor in case of parser failures
Diffstat (limited to 'test')
-rw-r--r--test/unit_inbroker_non_parallel_SUITE.erl32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/unit_inbroker_non_parallel_SUITE.erl b/test/unit_inbroker_non_parallel_SUITE.erl
index 266f0d30c0..cc14001df6 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.
@@ -744,6 +745,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.
%% ---------------------------------------------------------------------------