diff options
| author | Michael Klishin <michael@novemberain.com> | 2015-09-17 06:04:00 -0700 |
|---|---|---|
| committer | Michael Klishin <michael@novemberain.com> | 2015-09-17 06:04:00 -0700 |
| commit | 0c9bf69dc9d96cfe4b100c289e7ef259caa74253 (patch) | |
| tree | 0fac2cf1e77b173dc74e8fa073f71f2079457b36 /test | |
| parent | ef60743ac759d49364feeb2312cd0d1bf11c5478 (diff) | |
| parent | 0a44d9d91680a2dda5de5327163781dd595d4209 (diff) | |
| download | rabbitmq-server-git-0c9bf69dc9d96cfe4b100c289e7ef259caa74253.tar.gz | |
Merge pull request #306 from rabbitmq/rabbitmq-server-143-stable
Backport configurable credit flow to stable
Diffstat (limited to 'test')
| -rw-r--r-- | test/src/credit_flow_test.erl | 49 | ||||
| -rw-r--r-- | test/src/rabbit_tests.erl | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/src/credit_flow_test.erl b/test/src/credit_flow_test.erl new file mode 100644 index 0000000000..148c9024f1 --- /dev/null +++ b/test/src/credit_flow_test.erl @@ -0,0 +1,49 @@ +%% The contents of this file are subject to the Mozilla Public License +%% Version 1.1 (the "License"); you may not use this file except in +%% compliance with the License. You may obtain a copy of the License at +%% http://www.mozilla.org/MPL/ +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +%% License for the specific language governing rights and limitations +%% under the License. +%% +%% The Original Code is RabbitMQ. +%% +%% The Initial Developer of the Original Code is GoPivotal, Inc. +%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% + +-module(credit_flow_test). + +-export([test_credit_flow_settings/0]). + +test_credit_flow_settings() -> + %% default values + passed = test_proc(200, 50), + + application:set_env(rabbit, credit_flow_default_credit, {100, 20}), + passed = test_proc(100, 20), + + application:unset_env(rabbit, credit_flow_default_credit), + % back to defaults + passed = test_proc(200, 50), + passed. + +test_proc(InitialCredit, MoreCreditAfter) -> + Pid = spawn(fun dummy/0), + Pid ! {credit, self()}, + {InitialCredit, MoreCreditAfter} = + receive + {credit, Val} -> Val + end, + passed. + +dummy() -> + credit_flow:send(self()), + receive + {credit, From} -> + From ! {credit, get(credit_flow_default_credit)}; + _ -> + dummy() + end. diff --git a/test/src/rabbit_tests.erl b/test/src/rabbit_tests.erl index 39a276f102..6f0f5eb181 100644 --- a/test/src/rabbit_tests.erl +++ b/test/src/rabbit_tests.erl @@ -88,6 +88,7 @@ all_tests0() -> passed = test_configurable_server_properties(), passed = vm_memory_monitor_tests:all_tests(), passed = on_disk_store_tunable_parameter_validation_test:test_msg_store_parameter_validation(), + passed = credit_flow_test:test_credit_flow_settings(), passed. |
