aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-10-25 00:09:39 +0100
committerJustin Clark-Casey (justincc)2014-11-25 23:22:20 +0000
commitec3b43d28d971c6208538e34fc78aad6a437bf41 (patch)
treed4dc65a2838c47ae828dd58cf53c0c3f3fb14318 /OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
parentminor: In "show client stats" command, properly handle the case where a clien... (diff)
downloadopensim-SC_OLD-ec3b43d28d971c6208538e34fc78aad6a437bf41.zip
opensim-SC_OLD-ec3b43d28d971c6208538e34fc78aad6a437bf41.tar.gz
opensim-SC_OLD-ec3b43d28d971c6208538e34fc78aad6a437bf41.tar.bz2
opensim-SC_OLD-ec3b43d28d971c6208538e34fc78aad6a437bf41.tar.xz
Make regression throttle tests consistently test target and max throttle settings.
As part of this also refactors code to put all throttle asserts in a single regression test method
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs198
1 files changed, 62 insertions, 136 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
index 7991996..f7f69de 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
@@ -83,20 +83,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
83 SetThrottles( 83 SetThrottles(
84 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 84 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
85 85
86 ClientInfo ci = udpClient.GetClientInfo();
87
88 // We expect this to be lower because of the minimum bound set by MTU 86 // We expect this to be lower because of the minimum bound set by MTU
89 int totalBytes = LLUDPServer.MTU + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes; 87 int totalBytes = LLUDPServer.MTU + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes;
90 Assert.AreEqual(LLUDPServer.MTU, ci.resendThrottle); 88
91 Assert.AreEqual(landBytes, ci.landThrottle); 89 AssertThrottles(
92 Assert.AreEqual(windBytes, ci.windThrottle); 90 udpClient,
93 Assert.AreEqual(cloudBytes, ci.cloudThrottle); 91 LLUDPServer.MTU, landBytes, windBytes, cloudBytes, taskBytes,
94 Assert.AreEqual(taskBytes, ci.taskThrottle); 92 textureBytes, assetBytes, totalBytes, 0, 0);
95 Assert.AreEqual(textureBytes, ci.textureThrottle);
96 Assert.AreEqual(assetBytes, ci.assetThrottle);
97 Assert.AreEqual(totalBytes, ci.totalThrottle);
98
99 Assert.AreEqual(0, ci.maxThrottle);
100 } 93 }
101 94
102 [Test] 95 [Test]
@@ -133,8 +126,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
133 SetThrottles( 126 SetThrottles(
134 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 127 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
135 128
136 ClientInfo ci = udpClient.GetClientInfo();
137
138 // We expect individual throttle changes to currently have no effect under adaptive, since this is managed 129 // We expect individual throttle changes to currently have no effect under adaptive, since this is managed
139 // purely by that throttle. However, we expect the max to change. 130 // purely by that throttle. However, we expect the max to change.
140 // XXX: At the moment we check against defaults, but at some point there should be a better test to 131 // XXX: At the moment we check against defaults, but at some point there should be a better test to
@@ -145,16 +136,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
145 int totalBytes = defaultRates.Resend + defaultRates.Land + defaultRates.Wind + defaultRates.Cloud + defaultRates.Task + defaultRates.Texture + defaultRates.Asset; 136 int totalBytes = defaultRates.Resend + defaultRates.Land + defaultRates.Wind + defaultRates.Cloud + defaultRates.Task + defaultRates.Texture + defaultRates.Asset;
146 int totalMaxBytes = resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes; 137 int totalMaxBytes = resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes;
147 138
148 Assert.AreEqual(0, ci.maxThrottle); 139 AssertThrottles(
149 Assert.AreEqual(totalMaxBytes, ci.targetThrottle); 140 udpClient,
150 Assert.AreEqual(defaultRates.Resend, ci.resendThrottle); 141 defaultRates.Resend, defaultRates.Land, defaultRates.Wind, defaultRates.Cloud, defaultRates.Task,
151 Assert.AreEqual(defaultRates.Land, ci.landThrottle); 142 defaultRates.Texture, defaultRates.Asset, totalBytes, totalMaxBytes, 0);
152 Assert.AreEqual(defaultRates.Wind, ci.windThrottle);
153 Assert.AreEqual(defaultRates.Cloud, ci.cloudThrottle);
154 Assert.AreEqual(defaultRates.Task, ci.taskThrottle);
155 Assert.AreEqual(defaultRates.Texture, ci.textureThrottle);
156 Assert.AreEqual(defaultRates.Asset, ci.assetThrottle);
157 Assert.AreEqual(totalBytes, ci.totalThrottle);
158 } 143 }
159 144
160 /// <summary> 145 /// <summary>
@@ -189,22 +174,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
189 SetThrottles( 174 SetThrottles(
190 udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 175 udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
191 176
192 { 177 AssertThrottles(
193 ClientInfo ci = udpClient1.GetClientInfo(); 178 udpClient1,
194 179 resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2,
195 // Console.WriteLine( 180 textureBytes / 2, assetBytes / 2, totalBytes, 0, 0);
196 // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}",
197 // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle);
198
199 Assert.AreEqual(resendBytes / 2, ci.resendThrottle);
200 Assert.AreEqual(landBytes / 2, ci.landThrottle);
201 Assert.AreEqual(windBytes / 2, ci.windThrottle);
202 Assert.AreEqual(cloudBytes / 2, ci.cloudThrottle);
203 Assert.AreEqual(taskBytes / 2, ci.taskThrottle);
204 Assert.AreEqual(textureBytes / 2, ci.textureThrottle);
205 Assert.AreEqual(assetBytes / 2, ci.assetThrottle);
206 Assert.AreEqual(totalBytes, ci.totalThrottle);
207 }
208 181
209 // Now add another client 182 // Now add another client
210 ScenePresence sp2 183 ScenePresence sp2
@@ -217,39 +190,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
217 SetThrottles( 190 SetThrottles(
218 udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 191 udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
219 192
220 { 193 AssertThrottles(
221 ClientInfo ci = udpClient1.GetClientInfo(); 194 udpClient1,
222 195 resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4,
223// Console.WriteLine( 196 textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0);
224// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", 197
225// ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); 198 AssertThrottles(
226 199 udpClient2,
227 Assert.AreEqual(resendBytes / 4, ci.resendThrottle); 200 resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4,
228 Assert.AreEqual(landBytes / 4, ci.landThrottle); 201 textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0);
229 Assert.AreEqual(windBytes / 4, ci.windThrottle);
230 Assert.AreEqual(cloudBytes / 4, ci.cloudThrottle);
231 Assert.AreEqual(taskBytes / 4, ci.taskThrottle);
232 Assert.AreEqual(textureBytes / 4, ci.textureThrottle);
233 Assert.AreEqual(assetBytes / 4, ci.assetThrottle);
234 Assert.AreEqual(totalBytes / 2, ci.totalThrottle);
235 }
236
237 {
238 ClientInfo ci = udpClient2.GetClientInfo();
239
240 // Console.WriteLine(
241 // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}",
242 // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle);
243
244 Assert.AreEqual(resendBytes / 4, ci.resendThrottle);
245 Assert.AreEqual(landBytes / 4, ci.landThrottle);
246 Assert.AreEqual(windBytes / 4, ci.windThrottle);
247 Assert.AreEqual(cloudBytes / 4, ci.cloudThrottle);
248 Assert.AreEqual(taskBytes / 4, ci.taskThrottle);
249 Assert.AreEqual(textureBytes / 4, ci.textureThrottle);
250 Assert.AreEqual(assetBytes / 4, ci.assetThrottle);
251 Assert.AreEqual(totalBytes / 2, ci.totalThrottle);
252 }
253 } 202 }
254 203
255 /// <summary> 204 /// <summary>
@@ -285,20 +234,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
285 SetThrottles( 234 SetThrottles(
286 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 235 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
287 236
288 ClientInfo ci = udpClient.GetClientInfo(); 237 AssertThrottles(
289 238 udpClient,
290// Console.WriteLine( 239 resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2,
291// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", 240 textureBytes / 2, assetBytes / 2, totalBytes, 0, totalBytes);
292// ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle);
293
294 Assert.AreEqual(resendBytes / 2, ci.resendThrottle);
295 Assert.AreEqual(landBytes / 2, ci.landThrottle);
296 Assert.AreEqual(windBytes / 2, ci.windThrottle);
297 Assert.AreEqual(cloudBytes / 2, ci.cloudThrottle);
298 Assert.AreEqual(taskBytes / 2, ci.taskThrottle);
299 Assert.AreEqual(textureBytes / 2, ci.textureThrottle);
300 Assert.AreEqual(assetBytes / 2, ci.assetThrottle);
301 Assert.AreEqual(totalBytes, ci.totalThrottle);
302 } 241 }
303 242
304 [Test] 243 [Test]
@@ -333,22 +272,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
333 SetThrottles( 272 SetThrottles(
334 udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 273 udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
335 274
336 { 275 AssertThrottles(
337 ClientInfo ci = udpClient1.GetClientInfo(); 276 udpClient1,
338 277 resendBytes, landBytes, windBytes, cloudBytes, taskBytes,
339 // Console.WriteLine( 278 textureBytes, assetBytes, totalBytes, 0, totalBytes * 1.1);
340 // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}",
341 // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle);
342
343 Assert.AreEqual(resendBytes, ci.resendThrottle);
344 Assert.AreEqual(landBytes, ci.landThrottle);
345 Assert.AreEqual(windBytes, ci.windThrottle);
346 Assert.AreEqual(cloudBytes, ci.cloudThrottle);
347 Assert.AreEqual(taskBytes, ci.taskThrottle);
348 Assert.AreEqual(textureBytes, ci.textureThrottle);
349 Assert.AreEqual(assetBytes, ci.assetThrottle);
350 Assert.AreEqual(totalBytes, ci.totalThrottle);
351 }
352 279
353 // Now add another client 280 // Now add another client
354 ScenePresence sp2 281 ScenePresence sp2
@@ -361,39 +288,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
361 SetThrottles( 288 SetThrottles(
362 udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 289 udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
363 290
364 { 291 AssertThrottles(
365 ClientInfo ci = udpClient1.GetClientInfo(); 292 udpClient1,
366 293 resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75,
367// Console.WriteLine( 294 textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1);
368// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", 295
369// ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); 296 AssertThrottles(
370 297 udpClient2,
371 Assert.AreEqual(resendBytes * 0.75, ci.resendThrottle); 298 resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75,
372 Assert.AreEqual(landBytes * 0.75, ci.landThrottle); 299 textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1);
373 Assert.AreEqual(windBytes * 0.75, ci.windThrottle); 300 }
374 Assert.AreEqual(cloudBytes * 0.75, ci.cloudThrottle); 301
375 Assert.AreEqual(taskBytes * 0.75, ci.taskThrottle); 302 private void AssertThrottles(
376 Assert.AreEqual(textureBytes * 0.75, ci.textureThrottle); 303 LLUDPClient udpClient,
377 Assert.AreEqual(assetBytes * 0.75, ci.assetThrottle); 304 double resendBytes, double landBytes, double windBytes, double cloudBytes, double taskBytes, double textureBytes, double assetBytes,
378 Assert.AreEqual(totalBytes * 0.75, ci.totalThrottle); 305 double totalBytes, double targetBytes, double maxBytes)
379 } 306 {
380 307 ClientInfo ci = udpClient.GetClientInfo();
381 { 308
382 ClientInfo ci = udpClient2.GetClientInfo(); 309 // Console.WriteLine(
383 310 // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}",
384// Console.WriteLine( 311 // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle);
385// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", 312
386// ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); 313 Assert.AreEqual((int)resendBytes, ci.resendThrottle);
387 314 Assert.AreEqual((int)landBytes, ci.landThrottle);
388 Assert.AreEqual(resendBytes * 0.75, ci.resendThrottle); 315 Assert.AreEqual((int)windBytes, ci.windThrottle);
389 Assert.AreEqual(landBytes * 0.75, ci.landThrottle); 316 Assert.AreEqual((int)cloudBytes, ci.cloudThrottle);
390 Assert.AreEqual(windBytes * 0.75, ci.windThrottle); 317 Assert.AreEqual((int)taskBytes, ci.taskThrottle);
391 Assert.AreEqual(cloudBytes * 0.75, ci.cloudThrottle); 318 Assert.AreEqual((int)textureBytes, ci.textureThrottle);
392 Assert.AreEqual(taskBytes * 0.75, ci.taskThrottle); 319 Assert.AreEqual((int)assetBytes, ci.assetThrottle);
393 Assert.AreEqual(textureBytes * 0.75, ci.textureThrottle); 320 Assert.AreEqual((int)totalBytes, ci.totalThrottle);
394 Assert.AreEqual(assetBytes * 0.75, ci.assetThrottle); 321 Assert.AreEqual((int)targetBytes, ci.targetThrottle);
395 Assert.AreEqual(totalBytes * 0.75, ci.totalThrottle); 322 Assert.AreEqual((int)maxBytes, ci.maxThrottle);
396 }
397 } 323 }
398 324
399 private void SetThrottles( 325 private void SetThrottles(