Watcher: Fix timeout tests by increasing wait timeout

The request timeout and the real time the webserver slept was 5000ms.
In case of loaded systems, there might be cases, where the request was
still received in time.

This commit increases the server side sleep time to 10 seconds, to ensure
that the client aborts the request early

Original commit: elastic/x-pack-elasticsearch@718c05519f
This commit is contained in:
Alexander Reelsen 2016-02-25 14:23:34 -08:00
parent 2daef601d4
commit 4eef709d2e

View File

@ -93,7 +93,7 @@ public class HttpReadTimeoutTests extends ESTestCase {
long start = System.nanoTime();
try {
httpClient.execute(request);
fail("expected read timeout after 5 seconds (default)");
fail("expected read timeout after 3 seconds (default)");
} catch (ElasticsearchTimeoutException ete) {
// expected
@ -105,7 +105,7 @@ public class HttpReadTimeoutTests extends ESTestCase {
assertThat(timeout.seconds(), lessThan(5L));
}
if (!latch.await(10, TimeUnit.SECONDS)) {
if (!latch.await(7, TimeUnit.SECONDS)) {
// should never happen
fail("waited too long for the response to be returned");
}
@ -132,7 +132,7 @@ public class HttpReadTimeoutTests extends ESTestCase {
long start = System.nanoTime();
try {
httpClient.execute(request);
fail("expected read timeout after 5 seconds (default)");
fail("expected read timeout after 5 seconds");
} catch (ElasticsearchTimeoutException ete) {
// expected
@ -163,7 +163,7 @@ public class HttpReadTimeoutTests extends ESTestCase {
@Override
public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
if (path.equals(request.getPath())) {
Thread.sleep(5000);
Thread.sleep(10000);
latch.countDown();
}
return new MockResponse().setStatus("200");