diff options
author | Justin Clark-Casey (justincc) | 2014-10-25 00:32:46 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-11-25 23:22:20 +0000 |
commit | 8a949f0ee10a450de7b44f9d366e24847f69d23f (patch) | |
tree | 63a21a01c70f30ae8cd510b589e8608726c169ca /OpenSim/Region/ClientStack/Linden | |
parent | Make regression throttle tests consistently test target and max throttle sett... (diff) | |
download | opensim-SC_OLD-8a949f0ee10a450de7b44f9d366e24847f69d23f.zip opensim-SC_OLD-8a949f0ee10a450de7b44f9d366e24847f69d23f.tar.gz opensim-SC_OLD-8a949f0ee10a450de7b44f9d366e24847f69d23f.tar.bz2 opensim-SC_OLD-8a949f0ee10a450de7b44f9d366e24847f69d23f.tar.xz |
Add regression tests for token buckets on their own
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index f7f69de..cd87928 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | |||
@@ -55,6 +55,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
55 | } | 55 | } |
56 | 56 | ||
57 | [Test] | 57 | [Test] |
58 | public void TestSetRequestDripRate() | ||
59 | { | ||
60 | TokenBucket tb = new TokenBucket("tb", null, 5000, 0); | ||
61 | AssertRates(tb, 5000, 5000, 0); | ||
62 | |||
63 | tb.RequestedDripRate = 4000; | ||
64 | AssertRates(tb, 4000, 4000, 0); | ||
65 | |||
66 | tb.RequestedDripRate = 6000; | ||
67 | AssertRates(tb, 6000, 6000, 0); | ||
68 | } | ||
69 | |||
70 | [Test] | ||
71 | public void TestSetRequestDripRateWithMax() | ||
72 | { | ||
73 | TokenBucket tb = new TokenBucket("tb", null, 5000, 10000); | ||
74 | AssertRates(tb, 5000, 5000, 10000); | ||
75 | |||
76 | tb.RequestedDripRate = 4000; | ||
77 | AssertRates(tb, 4000, 4000, 10000); | ||
78 | |||
79 | tb.RequestedDripRate = 6000; | ||
80 | AssertRates(tb, 6000, 6000, 10000); | ||
81 | |||
82 | tb.RequestedDripRate = 12000; | ||
83 | AssertRates(tb, 10000, 10000, 10000); | ||
84 | } | ||
85 | |||
86 | [Test] | ||
87 | public void TestSetRequestDripRateWithChildren() | ||
88 | { | ||
89 | TokenBucket tbParent = new TokenBucket("tbParent", null, 0, 0); | ||
90 | TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0); | ||
91 | TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0); | ||
92 | |||
93 | AssertRates(tbParent, 8000, 8000, 0); | ||
94 | AssertRates(tbChild1, 3000, 3000, 0); | ||
95 | AssertRates(tbChild2, 5000, 5000, 0); | ||
96 | } | ||
97 | |||
98 | private void AssertRates(TokenBucket tb, double dripRate, double totalDripRequest, double maxDripRate) | ||
99 | { | ||
100 | Assert.AreEqual((int)dripRate, tb.DripRate); | ||
101 | Assert.AreEqual((int)totalDripRequest, tb.TotalDripRequest); | ||
102 | Assert.AreEqual((int)maxDripRate, tb.MaxDripRate); | ||
103 | } | ||
104 | |||
105 | [Test] | ||
58 | public void TestClientThrottleSetNoLimit() | 106 | public void TestClientThrottleSetNoLimit() |
59 | { | 107 | { |
60 | TestHelpers.InMethod(); | 108 | TestHelpers.InMethod(); |
@@ -179,7 +227,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
179 | resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, | 227 | resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, |
180 | textureBytes / 2, assetBytes / 2, totalBytes, 0, 0); | 228 | textureBytes / 2, assetBytes / 2, totalBytes, 0, 0); |
181 | 229 | ||
182 | // Now add another client | 230 | // Test: Now add another client |
183 | ScenePresence sp2 | 231 | ScenePresence sp2 |
184 | = ClientStackHelpers.AddChildClient( | 232 | = ClientStackHelpers.AddChildClient( |
185 | scene, udpServer, TestHelpers.ParseTail(0x10), TestHelpers.ParseTail(0x20), 123457); | 233 | scene, udpServer, TestHelpers.ParseTail(0x10), TestHelpers.ParseTail(0x20), 123457); |