diff options
| -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 |
