more generous test times

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2018-03-14 16:05:16 +11:00
parent a810ecf67e
commit ed907f8ed9
1 changed files with 5 additions and 5 deletions

View File

@ -218,28 +218,28 @@ public class LowResourcesMonitorTest
@Test
public void testMaxLowResourceTime() throws Exception
{
_lowResourcesMonitor.setMaxLowResourcesTime(2000);
_lowResourcesMonitor.setMaxLowResourcesTime(5000);
Assert.assertFalse(_lowResourcesMonitor.isLowOnResources());
try(Socket socket0 = new Socket("localhost",_connector.getLocalPort()))
{
_lowResourcesMonitor.setMaxMemory(1);
Thread.sleep(1200);
Thread.sleep(2400);
Assert.assertTrue(_lowResourcesMonitor.isLowOnResources());
try(Socket socket1 = new Socket("localhost",_connector.getLocalPort()))
{
Thread.sleep(1200);
Thread.sleep(2400);
Assert.assertTrue(_lowResourcesMonitor.isLowOnResources());
Assert.assertEquals(-1,socket0.getInputStream().read());
socket1.getOutputStream().write("G".getBytes(StandardCharsets.UTF_8));
Thread.sleep(1200);
Thread.sleep(2400);
Assert.assertTrue(_lowResourcesMonitor.isLowOnResources());
socket1.getOutputStream().write("E".getBytes(StandardCharsets.UTF_8));
Thread.sleep(1200);
Thread.sleep(2400);
Assert.assertTrue(_lowResourcesMonitor.isLowOnResources());
Assert.assertEquals(-1,socket1.getInputStream().read());
}