summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2010-07-19 13:35:01 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2010-07-19 13:35:01 +0100
commitd3f7800dd364eb53781f8eee437284a3d401e730 (patch)
tree1af12014c03c92726379a231583285e354668ce3
parentfee1562beec1e481fb281bce5d8e11c0320de1ab (diff)
downloadrabbitmq-server-d3f7800dd364eb53781f8eee437284a3d401e730.tar.gz
refactor: simplify msg_store tests
-rw-r--r--src/rabbit_tests.erl34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index c1b52e68..34ff55fe 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -1400,25 +1400,21 @@ msg_store_sync(Guids) ->
end.
msg_store_read(Guids, MSCState) ->
- lists:foldl(
- fun (Guid, MSCStateM) ->
- {{ok, Guid}, MSCStateN} = rabbit_msg_store:read(
- ?PERSISTENT_MSG_STORE, Guid, MSCStateM),
- MSCStateN
- end,
- MSCState, Guids).
+ lists:foldl(fun (Guid, MSCStateM) ->
+ {{ok, Guid}, MSCStateN} = rabbit_msg_store:read(
+ ?PERSISTENT_MSG_STORE,
+ Guid, MSCStateM),
+ MSCStateN
+ end, MSCState, Guids).
msg_store_write(Guids, MSCState) ->
- lists:foldl(
- fun (Guid, {ok, MSCStateN}) ->
- rabbit_msg_store:write(?PERSISTENT_MSG_STORE, Guid, Guid, MSCStateN) end,
- {ok, MSCState}, Guids).
+ lists:foldl(fun (Guid, {ok, MSCStateN}) ->
+ rabbit_msg_store:write(?PERSISTENT_MSG_STORE,
+ Guid, Guid, MSCStateN)
+ end, {ok, MSCState}, Guids).
-msg_store_remove(Ids) ->
- lists:foldl(fun (Guid, ok) ->
- rabbit_msg_store:remove(?PERSISTENT_MSG_STORE,
- [guid_bin(Guid)])
- end, ok, Ids).
+msg_store_remove(Guids) ->
+ rabbit_msg_store:remove(?PERSISTENT_MSG_STORE, Guids).
foreach_with_msg_store_client(Store, Ref, Fun, L) ->
rabbit_msg_store:client_terminate(
@@ -1539,13 +1535,13 @@ test_msg_store() ->
MSCStateN
end, GuidsBig),
%% .., then 3s by 1...
- ok = msg_store_remove(lists:seq(BigCount, 1, -3)),
+ ok = msg_store_remove([guid_bin(X) || X <- lists:seq(BigCount, 1, -3)]),
%% .., then remove 3s by 2, from the young end first. This hits
%% GC (under 50% good data left, but no empty files. Must GC).
- ok = msg_store_remove(lists:seq(BigCount-1, 1, -3)),
+ ok = msg_store_remove([guid_bin(X) || X <- lists:seq(BigCount-1, 1, -3)]),
%% .., then remove 3s by 3, from the young end first. This hits
%% GC...
- ok = msg_store_remove(lists:seq(BigCount-2, 1, -3)),
+ ok = msg_store_remove([guid_bin(X) || X <- lists:seq(BigCount-2, 1, -3)]),
%% ensure empty
false = msg_store_contains(false, GuidsBig),
%% restart empty