diff options
author | Justin Clark-Casey (justincc) | 2014-10-08 23:54:11 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-11-25 23:21:37 +0000 |
commit | dce98acb692ba6e9f5f85858ef1e305c618cc454 (patch) | |
tree | 37e68268455bd30c799b67581e028e3a440c4599 | |
parent | factor out common throttle setting byte[] array construction in ThrottleTests. (diff) | |
download | opensim-SC-dce98acb692ba6e9f5f85858ef1e305c618cc454.zip opensim-SC-dce98acb692ba6e9f5f85858ef1e305c618cc454.tar.gz opensim-SC-dce98acb692ba6e9f5f85858ef1e305c618cc454.tar.bz2 opensim-SC-dce98acb692ba6e9f5f85858ef1e305c618cc454.tar.xz |
Add regression test TestClientThrottleRegionLimited() for testing simple behaviour of throttles where a region-wide total outbound limit is in place.
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 52 |
1 files changed, 50 insertions, 2 deletions
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 | |||
98 | /// Test throttle setttings where max client throttle has been limited server side. | 98 | /// Test throttle setttings where max client throttle has been limited server side. |
99 | /// </summary> | 99 | /// </summary> |
100 | [Test] | 100 | [Test] |
101 | public void TestClientThrottleLimited() | 101 | public void TestClientThrottleRegionLimited() |
102 | { | ||
103 | TestHelpers.InMethod(); | ||
104 | // TestHelpers.EnableLogging(); | ||
105 | |||
106 | int resendBytes = 4000; | ||
107 | int landBytes = 6000; | ||
108 | int windBytes = 8000; | ||
109 | int cloudBytes = 10000; | ||
110 | int taskBytes = 12000; | ||
111 | int textureBytes = 14000; | ||
112 | int assetBytes = 16000; | ||
113 | int totalBytes | ||
114 | = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2); | ||
115 | |||
116 | Scene scene = new SceneHelpers().SetupScene(); | ||
117 | TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); | ||
118 | udpServer.Throttle.RequestedDripRate = totalBytes; | ||
119 | |||
120 | ScenePresence sp | ||
121 | = ClientStackHelpers.AddChildClient( | ||
122 | scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); | ||
123 | |||
124 | LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient; | ||
125 | // udpClient.ThrottleDebugLevel = 1; | ||
126 | |||
127 | SetThrottles( | ||
128 | udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); | ||
129 | |||
130 | ClientInfo ci = udpClient.GetClientInfo(); | ||
131 | |||
132 | // Console.WriteLine( | ||
133 | // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", | ||
134 | // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); | ||
135 | |||
136 | Assert.AreEqual(resendBytes / 2, ci.resendThrottle); | ||
137 | Assert.AreEqual(landBytes / 2, ci.landThrottle); | ||
138 | Assert.AreEqual(windBytes / 2, ci.windThrottle); | ||
139 | Assert.AreEqual(cloudBytes / 2, ci.cloudThrottle); | ||
140 | Assert.AreEqual(taskBytes / 2, ci.taskThrottle); | ||
141 | Assert.AreEqual(textureBytes / 2, ci.textureThrottle); | ||
142 | Assert.AreEqual(assetBytes / 2, ci.assetThrottle); | ||
143 | Assert.AreEqual(totalBytes, ci.totalThrottle); | ||
144 | } | ||
145 | |||
146 | /// <summary> | ||
147 | /// Test throttle setttings where max client throttle has been limited server side. | ||
148 | /// </summary> | ||
149 | [Test] | ||
150 | public void TestClientThrottlePerClientLimited() | ||
102 | { | 151 | { |
103 | TestHelpers.InMethod(); | 152 | TestHelpers.InMethod(); |
104 | // TestHelpers.EnableLogging(); | 153 | // TestHelpers.EnableLogging(); |
@@ -133,7 +182,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
133 | // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", | 182 | // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", |
134 | // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); | 183 | // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); |
135 | 184 | ||
136 | // We expect this to be lower because of the minimum bound set by MTU | ||
137 | Assert.AreEqual(resendBytes / 2, ci.resendThrottle); | 185 | Assert.AreEqual(resendBytes / 2, ci.resendThrottle); |
138 | Assert.AreEqual(landBytes / 2, ci.landThrottle); | 186 | Assert.AreEqual(landBytes / 2, ci.landThrottle); |
139 | Assert.AreEqual(windBytes / 2, ci.windThrottle); | 187 | Assert.AreEqual(windBytes / 2, ci.windThrottle); |