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 | 518705ee30888ceb519a378baa49327ff7c8550d (patch) | |
| tree | e001bfabe2b12b9e8229865387a9e9a88caa46d6 /src | |
| parent | 033fc53d7aba10cc70457c24fc712ee2325f7310 (diff) | |
| download | rabbitmq-server-git-518705ee30888ceb519a378baa49327ff7c8550d.tar.gz | |
add tests for msg_store confirm logic
Diffstat (limited to 'src')
| -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 b8f3694ddd..b2e516db58 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). |
