diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2011-10-11 22:42:37 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2011-10-11 22:42:37 +0100 |
commit | a9ee9013b47cfb01df1d4cc7e328e2263ce99646 (patch) | |
tree | e001bfabe2b12b9e8229865387a9e9a88caa46d6 | |
parent | b7f51c4a544aa5f2ebf4c5618023fc3933232cb6 (diff) | |
download | rabbitmq-server-a9ee9013b47cfb01df1d4cc7e328e2263ce99646.tar.gz |
add tests for msg_store confirm logic
-rw-r--r-- | src/rabbit_tests.erl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index b8f3694d..b2e516db 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -1929,6 +1929,8 @@ test_msg_store() -> ?PERSISTENT_MSG_STORE, Ref2), %% check we don't contain any of the msgs we're about to publish false = msg_store_contains(false, MsgIds, MSCState), + %% test confirm logic + passed = test_msg_store_confirms([hd(MsgIds)], Cap, MSCState), %% publish the first half ok = msg_store_write(MsgIds1stHalf, MSCState), %% sync on the first half @@ -2040,6 +2042,33 @@ test_msg_store() -> restart_msg_store_empty(), passed. +test_msg_store_confirms(MsgIds, Cap, MSCState) -> + %% write -> confirmed + ok = msg_store_write(MsgIds, MSCState), + ok = on_disk_await(Cap, MsgIds), + %% remove -> _ + ok = msg_store_remove(MsgIds, MSCState), + ok = on_disk_await(Cap, []), + %% write, remove -> confirmed + ok = msg_store_write(MsgIds, MSCState), + ok = msg_store_remove(MsgIds, MSCState), + ok = on_disk_await(Cap, MsgIds), + %% write, remove, write -> confirmed, confirmed + ok = msg_store_write(MsgIds, MSCState), + ok = msg_store_remove(MsgIds, MSCState), + ok = msg_store_write(MsgIds, MSCState), + ok = on_disk_await(Cap, MsgIds ++ MsgIds), + %% remove, write -> confirmed + ok = msg_store_remove(MsgIds, MSCState), + ok = msg_store_write(MsgIds, MSCState), + ok = on_disk_await(Cap, MsgIds), + %% remove, write, remove -> confirmed + ok = msg_store_remove(MsgIds, MSCState), + ok = msg_store_write(MsgIds, MSCState), + ok = msg_store_remove(MsgIds, MSCState), + ok = on_disk_await(Cap, MsgIds), + passed. + queue_name(Name) -> rabbit_misc:r(<<"/">>, queue, Name). |