From f1bf76e40adb74134c113abaddf424ec895ee864 Mon Sep 17 00:00:00 2001 From: Francesco Mazzoli Date: Thu, 19 Apr 2012 17:34:28 +0100 Subject: Changed BQ:dropwhile/3 to take a boolean arg to decide wether to ack or not. I'm most likely going to change this to two different functions, the only thing that is holding me back is that I'll end up writing one function and then two wrappers around it in both instances (variable_queue and queue_master). --- src/rabbit_tests.erl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/rabbit_tests.erl') diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index c74b8d5f..3e85e3d5 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -2388,10 +2388,10 @@ test_dropwhile(VQ0) -> fun (N, Props) -> Props#message_properties{expiry = N} end, VQ0), %% drop the first 5 messages - VQ2 = rabbit_variable_queue:dropwhile( - fun(#message_properties { expiry = Expiry }) -> - Expiry =< 5 - end, undefined, VQ1), + {undefined, VQ2} = rabbit_variable_queue:dropwhile( + fun(#message_properties { expiry = Expiry }) -> + Expiry =< 5 + end, false, VQ1), %% fetch five now VQ3 = lists:foldl(fun (_N, VQN) -> @@ -2408,11 +2408,11 @@ test_dropwhile(VQ0) -> test_dropwhile_varying_ram_duration(VQ0) -> VQ1 = variable_queue_publish(false, 1, VQ0), VQ2 = rabbit_variable_queue:set_ram_duration_target(0, VQ1), - VQ3 = rabbit_variable_queue:dropwhile( - fun(_) -> false end, undefined, VQ2), + {undefined, VQ3} = rabbit_variable_queue:dropwhile( + fun(_) -> false end, false, VQ2), VQ4 = rabbit_variable_queue:set_ram_duration_target(infinity, VQ3), VQ5 = variable_queue_publish(false, 1, VQ4), - rabbit_variable_queue:dropwhile(fun(_) -> false end, undefined, VQ5). + rabbit_variable_queue:dropwhile(fun(_) -> false end, false, VQ5). test_variable_queue_dynamic_duration_change(VQ0) -> SegmentSize = rabbit_queue_index:next_segment_boundary(0), -- cgit v1.2.1 From 01aa6010d87a4e4870360d5523fd05c58f1d1990 Mon Sep 17 00:00:00 2001 From: Francesco Mazzoli Date: Thu, 19 Apr 2012 18:42:40 +0100 Subject: Fix rabbit_tests - only get the state after calling bq:dropwhile. --- src/rabbit_tests.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/rabbit_tests.erl') diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index 3e85e3d5..04ee6ef2 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -2412,7 +2412,9 @@ test_dropwhile_varying_ram_duration(VQ0) -> fun(_) -> false end, false, VQ2), VQ4 = rabbit_variable_queue:set_ram_duration_target(infinity, VQ3), VQ5 = variable_queue_publish(false, 1, VQ4), - rabbit_variable_queue:dropwhile(fun(_) -> false end, false, VQ5). + {undefined, VQ6} = + rabbit_variable_queue:dropwhile(fun(_) -> false end, false, VQ5), + VQ6. test_variable_queue_dynamic_duration_change(VQ0) -> SegmentSize = rabbit_queue_index:next_segment_boundary(0), -- cgit v1.2.1