diff options
author | Justin Clark-Casey (justincc) | 2014-10-25 02:09:37 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-11-25 23:22:20 +0000 |
commit | b2e377f168967f7cedb32f077ee54b9f92439205 (patch) | |
tree | e6904f3c5a57a0334dd59c4164826c6dda0e1f69 /OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | |
parent | Add request drip rate to assertions for token bucket regression tests (diff) | |
download | opensim-SC-b2e377f168967f7cedb32f077ee54b9f92439205.zip opensim-SC-b2e377f168967f7cedb32f077ee54b9f92439205.tar.gz opensim-SC-b2e377f168967f7cedb32f077ee54b9f92439205.tar.bz2 opensim-SC-b2e377f168967f7cedb32f077ee54b9f92439205.tar.xz |
Fix setting of max scene throttle so that setting it restricts the child client throttles properly.
In "show throttles", also renames 'total' column to 'actual' to reflect that it is not necessarily the throttles requested for/by the client.
Also fills out 'target' in non-adapative mode to the actual throttle requested for/by the client.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 0d39c1d..912c994 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | |||
@@ -57,51 +57,71 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
57 | [Test] | 57 | [Test] |
58 | public void TestSetRequestDripRate() | 58 | public void TestSetRequestDripRate() |
59 | { | 59 | { |
60 | TestHelpers.InMethod(); | ||
61 | |||
60 | TokenBucket tb = new TokenBucket("tb", null, 5000, 0); | 62 | TokenBucket tb = new TokenBucket("tb", null, 5000, 0); |
61 | AssertRates(tb, 5000, 5000, 5000, 0); | 63 | AssertRates(tb, 5000, 0, 5000, 0); |
62 | 64 | ||
63 | tb.RequestedDripRate = 4000; | 65 | tb.RequestedDripRate = 4000; |
64 | AssertRates(tb, 4000, 4000, 4000, 0); | 66 | AssertRates(tb, 4000, 0, 4000, 0); |
65 | 67 | ||
66 | tb.RequestedDripRate = 6000; | 68 | tb.RequestedDripRate = 6000; |
67 | AssertRates(tb, 6000, 6000, 6000, 0); | 69 | AssertRates(tb, 6000, 0, 6000, 0); |
68 | } | 70 | } |
69 | 71 | ||
70 | [Test] | 72 | [Test] |
71 | public void TestSetRequestDripRateWithMax() | 73 | public void TestSetRequestDripRateWithMax() |
72 | { | 74 | { |
75 | TestHelpers.InMethod(); | ||
76 | |||
73 | TokenBucket tb = new TokenBucket("tb", null, 5000, 10000); | 77 | TokenBucket tb = new TokenBucket("tb", null, 5000, 10000); |
74 | AssertRates(tb, 5000, 5000, 5000, 10000); | 78 | AssertRates(tb, 5000, 0, 5000, 10000); |
75 | 79 | ||
76 | tb.RequestedDripRate = 4000; | 80 | tb.RequestedDripRate = 4000; |
77 | AssertRates(tb, 4000, 4000, 4000, 10000); | 81 | AssertRates(tb, 4000, 0, 4000, 10000); |
78 | 82 | ||
79 | tb.RequestedDripRate = 6000; | 83 | tb.RequestedDripRate = 6000; |
80 | AssertRates(tb, 6000, 6000, 6000, 10000); | 84 | AssertRates(tb, 6000, 0, 6000, 10000); |
81 | 85 | ||
82 | tb.RequestedDripRate = 12000; | 86 | tb.RequestedDripRate = 12000; |
83 | AssertRates(tb, 10000, 10000, 10000, 10000); | 87 | AssertRates(tb, 10000, 0, 10000, 10000); |
84 | } | 88 | } |
85 | 89 | ||
86 | [Test] | 90 | [Test] |
87 | public void TestSetRequestDripRateWithChildren() | 91 | public void TestSetRequestDripRateWithChildren() |
88 | { | 92 | { |
93 | TestHelpers.InMethod(); | ||
94 | |||
89 | TokenBucket tbParent = new TokenBucket("tbParent", null, 0, 0); | 95 | TokenBucket tbParent = new TokenBucket("tbParent", null, 0, 0); |
90 | TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0); | 96 | TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0); |
91 | TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0); | 97 | TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0); |
92 | 98 | ||
93 | AssertRates(tbParent, 8000, 8000, 8000, 0); | 99 | AssertRates(tbParent, 8000, 8000, 8000, 0); |
94 | AssertRates(tbChild1, 3000, 3000, 3000, 0); | 100 | AssertRates(tbChild1, 3000, 0, 3000, 0); |
95 | AssertRates(tbChild2, 5000, 5000, 5000, 0); | 101 | AssertRates(tbChild2, 5000, 0, 5000, 0); |
102 | |||
103 | // Test: Setting a parent request greater than total children requests. | ||
104 | tbParent.RequestedDripRate = 10000; | ||
105 | |||
106 | AssertRates(tbParent, 10000, 8000, 8000, 0); | ||
107 | AssertRates(tbChild1, 3000, 0, 3000, 0); | ||
108 | AssertRates(tbChild2, 5000, 0, 5000, 0); | ||
109 | |||
110 | // Test: Setting a parent request lower than total children requests. | ||
111 | tbParent.RequestedDripRate = 6000; | ||
112 | |||
113 | AssertRates(tbParent, 6000, 8000, 6000, 0); | ||
114 | AssertRates(tbChild1, 3000, 0, 6000 / 8 * 3, 0); | ||
115 | AssertRates(tbChild2, 5000, 0, 6000 / 8 * 5, 0); | ||
96 | } | 116 | } |
97 | 117 | ||
98 | private void AssertRates( | 118 | private void AssertRates( |
99 | TokenBucket tb, double requestedDripRate, double totalDripRequest, double dripRate, double maxDripRate) | 119 | TokenBucket tb, double requestedDripRate, double totalDripRequest, double dripRate, double maxDripRate) |
100 | { | 120 | { |
101 | Assert.AreEqual((int)requestedDripRate, tb.RequestedDripRate); | 121 | Assert.AreEqual((int)requestedDripRate, tb.RequestedDripRate, "Requested drip rate"); |
102 | Assert.AreEqual((int)totalDripRequest, tb.TotalDripRequest); | 122 | Assert.AreEqual((int)totalDripRequest, tb.TotalDripRequest, "Total drip request"); |
103 | Assert.AreEqual((int)dripRate, tb.DripRate); | 123 | Assert.AreEqual((int)dripRate, tb.DripRate, "Drip rate"); |
104 | Assert.AreEqual((int)maxDripRate, tb.MaxDripRate); | 124 | Assert.AreEqual((int)maxDripRate, tb.MaxDripRate, "Max drip rate"); |
105 | } | 125 | } |
106 | 126 | ||
107 | [Test] | 127 | [Test] |
@@ -360,16 +380,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
360 | // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", | 380 | // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", |
361 | // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); | 381 | // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); |
362 | 382 | ||
363 | Assert.AreEqual((int)resendBytes, ci.resendThrottle); | 383 | Assert.AreEqual((int)resendBytes, ci.resendThrottle, "Resend"); |
364 | Assert.AreEqual((int)landBytes, ci.landThrottle); | 384 | Assert.AreEqual((int)landBytes, ci.landThrottle, "Land"); |
365 | Assert.AreEqual((int)windBytes, ci.windThrottle); | 385 | Assert.AreEqual((int)windBytes, ci.windThrottle, "Wind"); |
366 | Assert.AreEqual((int)cloudBytes, ci.cloudThrottle); | 386 | Assert.AreEqual((int)cloudBytes, ci.cloudThrottle, "Cloud"); |
367 | Assert.AreEqual((int)taskBytes, ci.taskThrottle); | 387 | Assert.AreEqual((int)taskBytes, ci.taskThrottle, "Task"); |
368 | Assert.AreEqual((int)textureBytes, ci.textureThrottle); | 388 | Assert.AreEqual((int)textureBytes, ci.textureThrottle, "Texture"); |
369 | Assert.AreEqual((int)assetBytes, ci.assetThrottle); | 389 | Assert.AreEqual((int)assetBytes, ci.assetThrottle, "Asset"); |
370 | Assert.AreEqual((int)totalBytes, ci.totalThrottle); | 390 | Assert.AreEqual((int)totalBytes, ci.totalThrottle, "Total"); |
371 | Assert.AreEqual((int)targetBytes, ci.targetThrottle); | 391 | Assert.AreEqual((int)targetBytes, ci.targetThrottle, "Target"); |
372 | Assert.AreEqual((int)maxBytes, ci.maxThrottle); | 392 | Assert.AreEqual((int)maxBytes, ci.maxThrottle, "Max"); |
373 | } | 393 | } |
374 | 394 | ||
375 | private void SetThrottles( | 395 | private void SetThrottles( |