summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Klishin <michael@novemberain.com>2015-10-31 10:38:11 +0300
committerMichael Klishin <michael@novemberain.com>2015-10-31 10:38:11 +0300
commit0cc96cb8ca93a6bda9d6e3c00dc7047fbbf62731 (patch)
treeec4018949465e7cb3d18b62c95794c76da55ab94 /test
parenta74006936b7aaccd952d73b80561259430065170 (diff)
parent84dec3da91283e3a0bb153ac4437e2600ea1a96d (diff)
downloadrabbitmq-server-git-0cc96cb8ca93a6bda9d6e3c00dc7047fbbf62731.tar.gz
Merge pull request #397 from rabbitmq/rabbitmq-server-91
Disable disk monitor in unsupported platforms
Diffstat (limited to 'test')
-rw-r--r--test/src/rabbit_tests.erl24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/src/rabbit_tests.erl b/test/src/rabbit_tests.erl
index 0997478b66..e85cf98864 100644
--- a/test/src/rabbit_tests.erl
+++ b/test/src/rabbit_tests.erl
@@ -90,6 +90,13 @@ all_tests0() ->
passed = test_memory_high_watermark(),
passed = on_disk_store_tunable_parameter_validation_test:test_msg_store_parameter_validation(),
passed = credit_flow_test:test_credit_flow_settings(),
+ passed =
+ do_if_meck_enabled(
+ fun disk_monitor_test/0,
+ fun () ->
+ io:format("Skipping meck dependent tests ~n"),
+ passed
+ end),
passed.
@@ -101,6 +108,12 @@ do_if_secondary_node(Up, Down) ->
pang -> Down(SecondaryNode)
end.
+do_if_meck_enabled(Enabled, Disabled) ->
+ case code:which(meck) of
+ non_existing -> Disabled();
+ _ -> Enabled()
+ end.
+
setup_cluster() ->
do_if_secondary_node(
fun (SecondaryNode) ->
@@ -3060,3 +3073,14 @@ test_memory_high_watermark() ->
ok = control_action(set_vm_memory_high_watermark, [float_to_list(HWM)]),
passed.
+
+disk_monitor_test() ->
+ %% Issue: rabbitmq-server #91
+ %% os module could be mocked using 'unstick', however it may have undesired
+ %% side effects in following tests. Thus, we mock at rabbit_misc level
+ ok = meck:new(rabbit_misc, [passthrough]),
+ ok = meck:expect(rabbit_misc, os_cmd, fun(_) -> "\n" end),
+ ok = rabbit_sup:stop_child(rabbit_disk_monitor_sup),
+ ok = rabbit_sup:start_delayed_restartable_child(rabbit_disk_monitor, [1000]),
+ meck:unload(rabbit_misc),
+ passed.