diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2010-07-19 13:11:22 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2010-07-19 13:11:22 +0100 |
| commit | d01623eb6c8f181fec389830b2ed1b75fd7db929 (patch) | |
| tree | 214809d2739b232cfa3ce81ff273e5db7677295f | |
| parent | ddd2dc8517095b03c9b6e7aa52a02c2c77064d5e (diff) | |
| download | rabbitmq-server-git-d01623eb6c8f181fec389830b2ed1b75fd7db929.tar.gz | |
refactor: simplify msg_store tests
| -rw-r--r-- | src/rabbit_tests.erl | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index c1d3885b08..b506784e57 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -1414,6 +1414,12 @@ msg_store_write(Guids, MSCState) -> 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). + test_msg_store() -> stop_msg_store(), ok = start_msg_store_empty(), @@ -1528,22 +1534,13 @@ test_msg_store() -> MSCStateN end, rabbit_msg_store:client_init(?PERSISTENT_MSG_STORE, Ref), GuidsBig)), %% .., then 3s by 1... - ok = lists:foldl( - fun (Guid, ok) -> - rabbit_msg_store:remove(?PERSISTENT_MSG_STORE, [guid_bin(Guid)]) - end, ok, lists:seq(BigCount, 1, -3)), + ok = msg_store_remove(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 = lists:foldl( - fun (Guid, ok) -> - rabbit_msg_store:remove(?PERSISTENT_MSG_STORE, [guid_bin(Guid)]) - end, ok, lists:seq(BigCount-1, 1, -3)), + ok = msg_store_remove(lists:seq(BigCount-1, 1, -3)), %% .., then remove 3s by 3, from the young end first. This hits %% GC... - ok = lists:foldl( - fun (Guid, ok) -> - rabbit_msg_store:remove(?PERSISTENT_MSG_STORE, [guid_bin(Guid)]) - end, ok, lists:seq(BigCount-2, 1, -3)), + ok = msg_store_remove(lists:seq(BigCount-2, 1, -3)), %% ensure empty false = msg_store_contains(false, GuidsBig), %% restart empty |
