From dce98acb692ba6e9f5f85858ef1e305c618cc454 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 8 Oct 2014 23:54:11 +0100 Subject: Add regression test TestClientThrottleRegionLimited() for testing simple behaviour of throttles where a region-wide total outbound limit is in place. --- .../ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 52 +++++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 702e308..8c1e66c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs @@ -98,7 +98,56 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests /// Test throttle setttings where max client throttle has been limited server side. /// [Test] - public void TestClientThrottleLimited() + public void TestClientThrottleRegionLimited() + { + TestHelpers.InMethod(); + // TestHelpers.EnableLogging(); + + int resendBytes = 4000; + int landBytes = 6000; + int windBytes = 8000; + int cloudBytes = 10000; + int taskBytes = 12000; + int textureBytes = 14000; + int assetBytes = 16000; + int totalBytes + = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2); + + Scene scene = new SceneHelpers().SetupScene(); + TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); + udpServer.Throttle.RequestedDripRate = totalBytes; + + ScenePresence sp + = ClientStackHelpers.AddChildClient( + scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); + + LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient; + // udpClient.ThrottleDebugLevel = 1; + + SetThrottles( + udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); + + ClientInfo ci = udpClient.GetClientInfo(); + + // Console.WriteLine( + // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", + // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); + + Assert.AreEqual(resendBytes / 2, ci.resendThrottle); + Assert.AreEqual(landBytes / 2, ci.landThrottle); + Assert.AreEqual(windBytes / 2, ci.windThrottle); + Assert.AreEqual(cloudBytes / 2, ci.cloudThrottle); + Assert.AreEqual(taskBytes / 2, ci.taskThrottle); + Assert.AreEqual(textureBytes / 2, ci.textureThrottle); + Assert.AreEqual(assetBytes / 2, ci.assetThrottle); + Assert.AreEqual(totalBytes, ci.totalThrottle); + } + + /// + /// Test throttle setttings where max client throttle has been limited server side. + /// + [Test] + public void TestClientThrottlePerClientLimited() { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); @@ -133,7 +182,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); - // We expect this to be lower because of the minimum bound set by MTU Assert.AreEqual(resendBytes / 2, ci.resendThrottle); Assert.AreEqual(landBytes / 2, ci.landThrottle); Assert.AreEqual(windBytes / 2, ci.windThrottle); -- cgit v1.1