Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-6270: Increased timeouts for MultiThreadedOCPTest

Shalin Shekhar Mangar4b40a466341b
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 13971fc65e3..9a123b51050 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -281,6 +281,8 @@ Other Changes
* SOLR-3345: BaseDistributedSearchTestCase should always ignore QTime.
(Vamsee Yarlagadda, Benson Margulies via Mark Miller)
+* SOLR-6270: Increased timeouts for MultiThreadedOCPTest. (shalin)
+
================== 4.9.0 ==================
Versions of Major Components
diff --git a/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java b/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
index d8aed89e369..c85bd9bdd38 100644
--- a/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
@@ -34,17 +34,18 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Random;
+import java.util.concurrent.TimeUnit;
/**
* Tests the Multi threaded Collections API.
*/
public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
- private static final int REQUEST_STATUS_TIMEOUT = 90;
+ private static final int REQUEST_STATUS_TIMEOUT = 5 * 60;
private static Logger log = LoggerFactory
.getLogger(MultiThreadedOCPTest.class);
- private static int NUM_COLLECTIONS = 4;
+ private static final int NUM_COLLECTIONS = 4;
@Before
@Override
@@ -151,7 +152,7 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
CollectionAdminRequest.splitShard("ocptest_shardsplit2", SHARD1, server, "3001");
CollectionAdminRequest.splitShard("ocptest_shardsplit2", SHARD2, server, "3002");
- // Now submit another task with the same id. At this time, hopefully the previous 2002 should still be in the queue.
+ // Now submit another task with the same id. At this time, hopefully the previous 3002 should still be in the queue.
CollectionAdminResponse response = CollectionAdminRequest.splitShard("ocptest_shardsplit2", SHARD1, server, "3002");
NamedList r = response.getResponse();
assertEquals("Duplicate request was supposed to exist but wasn't found. De-duplication of submitted task failed.",
@@ -225,7 +226,9 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
private String getRequestStateAfterCompletion(String requestId, int waitForSeconds, SolrServer server)
throws IOException, SolrServerException {
String state = null;
- while(waitForSeconds-- > 0) {
+ long maxWait = System.nanoTime() + TimeUnit.NANOSECONDS.convert(waitForSeconds, TimeUnit.SECONDS);
+
+ while (System.nanoTime() < maxWait) {
state = getRequestState(requestId, server);
if(state.equals("completed") || state.equals("failed"))
return state;
@@ -234,6 +237,7 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
} catch (InterruptedException e) {
}
}
+
return state;
}