diff options
| author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-07-26 09:45:12 +0100 |
|---|---|---|
| committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-07-26 09:45:12 +0100 |
| commit | e583729ce620d628735e784da1a8104c58ef667f (patch) | |
| tree | ad125a14a3c10764b3937d7d5e4d2db61b90887a | |
| parent | 3ebcb5c24e092550f9c3e43682991c590b1ef254 (diff) | |
| download | rabbitmq-server-git-e583729ce620d628735e784da1a8104c58ef667f.tar.gz | |
selectively receive more messages during tests
| -rw-r--r-- | src/rabbit_tests.erl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index cff55c9186..516e913434 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -1081,6 +1081,11 @@ expect_normal_channel_termination(MRef, Ch) -> after 1000 -> throw(channel_failed_to_exit) end. +gobble_channel_exit() -> + receive {channel_exit, _, _} -> ok + after 1000 -> throw(channel_exit_not_received) + end. + test_memory_pressure() -> {Writer0, Ch0, MRef0} = test_memory_pressure_spawn(), [ok = rabbit_channel:conserve_memory(Ch0, Conserve) || @@ -1103,6 +1108,7 @@ test_memory_pressure() -> Content = rabbit_basic:build_content(#'P_basic'{}, <<>>), ok = rabbit_channel:do(Ch0, #'basic.publish'{}, Content), expect_normal_channel_termination(MRef0, Ch0), + gobble_channel_exit(), {Writer1, Ch1, MRef1} = test_memory_pressure_spawn(), ok = rabbit_channel:conserve_memory(Ch1, true), @@ -1114,19 +1120,23 @@ test_memory_pressure() -> %% send back the wrong flow_ok. Channel should die. ok = rabbit_channel:do(Ch1, #'channel.flow_ok'{active = false}), expect_normal_channel_termination(MRef1, Ch1), + gobble_channel_exit(), {_Writer2, Ch2, MRef2} = test_memory_pressure_spawn(), %% just out of the blue, send a flow_ok. Life should end. ok = rabbit_channel:do(Ch2, #'channel.flow_ok'{active = true}), expect_normal_channel_termination(MRef2, Ch2), + gobble_channel_exit(), {_Writer3, Ch3, MRef3} = test_memory_pressure_spawn(), ok = rabbit_channel:conserve_memory(Ch3, true), + ok = test_memory_pressure_receive_flow(false), receive {'DOWN', MRef3, process, Ch3, _} -> ok after 12000 -> throw(channel_failed_to_exit) end, + gobble_channel_exit(), alarm_handler:set_alarm({vm_memory_high_watermark, []}), Me = self(), |
