summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Klishin <mklishin@pivotal.io>2017-02-08 12:15:10 +0300
committerMichael Klishin <mklishin@pivotal.io>2017-02-08 12:15:10 +0300
commitf5b3d3ed6fbadd0bcf351db4774fdb349b7c7b3d (patch)
treea91f7fd26e608d5946a158c5b223e3f0ab12c202 /test
parent562449c5f7c74535f222ba64356c6bc6561db449 (diff)
downloadrabbitmq-server-git-f5b3d3ed6fbadd0bcf351db4774fdb349b7c7b3d.tar.gz
Rework credit_flow test to not depend on application env
Every time it is updated we forget to update the test, plus at least one time it took a few hours to even find out what exactly was failing (yes, even with CT logs). This test doesn't have to use application environment values anyway.
Diffstat (limited to 'test')
-rw-r--r--test/unit_inbroker_SUITE.erl22
1 files changed, 8 insertions, 14 deletions
diff --git a/test/unit_inbroker_SUITE.erl b/test/unit_inbroker_SUITE.erl
index 7f5a8db3cb..9d0b84e733 100644
--- a/test/unit_inbroker_SUITE.erl
+++ b/test/unit_inbroker_SUITE.erl
@@ -1691,24 +1691,18 @@ check_variable_queue_status(VQ0, Props) ->
%% ---------------------------------------------------------------------------
credit_flow_settings(Config) ->
- passed = rabbit_ct_broker_helpers:rpc(Config, 0,
+ rabbit_ct_broker_helpers:rpc(Config, 0,
?MODULE, credit_flow_settings1, [Config]).
credit_flow_settings1(_Config) ->
- %% default values
- passed = test_proc(400, 200),
-
- application:set_env(rabbit, credit_flow_default_credit, {600, 300}),
+ passed = test_proc(400, 200, {400, 200}),
passed = test_proc(600, 300),
-
- application:unset_env(rabbit, credit_flow_default_credit),
-
- % back to defaults
- passed = test_proc(400, 200),
passed.
test_proc(InitialCredit, MoreCreditAfter) ->
- Pid = spawn(fun dummy/0),
+ test_proc(InitialCredit, MoreCreditAfter, {InitialCredit, MoreCreditAfter}).
+test_proc(InitialCredit, MoreCreditAfter, Settings) ->
+ Pid = spawn(?MODULE, dummy, [Settings]),
Pid ! {credit, self()},
{InitialCredit, MoreCreditAfter} =
receive
@@ -1716,13 +1710,13 @@ test_proc(InitialCredit, MoreCreditAfter) ->
end,
passed.
-dummy() ->
+dummy(Settings) ->
credit_flow:send(self()),
receive
{credit, From} ->
- From ! {credit, get(credit_flow_default_credit)};
+ From ! {credit, Settings};
_ ->
- dummy()
+ dummy(Settings)
end.
%% -------------------------------------------------------------------