Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-16697: Up AbstractInstallShardTest timeout

Jason Gerlowski5cee99678fba
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractInstallShardTest.java b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractInstallShardTest.java
index 08dfc1934d5..8bcd85077b7 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractInstallShardTest.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractInstallShardTest.java
@@ -105,9 +105,9 @@ public abstract class AbstractInstallShardTest extends SolrCloudTestCase {
private List<String> collectionsToDelete;
public static void bootstrapBackupRepositoryData(String baseRepositoryLocation) throws Exception {
- final int numShards = random().nextInt(3) + 2;
+ final int numShards = /*random().nextInt(3) + 2*/ 4;
multiShardUris = new URI[numShards];
- replicasPerShard = random().nextInt(3) + 1;
+ replicasPerShard = /*random().nextInt(3) + 1;*/ 3;
CloudSolrClient solrClient = cluster.getSolrClient();
// Create collections and index docs
@@ -362,22 +362,27 @@ public abstract class AbstractInstallShardTest extends SolrCloudTestCase {
final ExecutorService executor =
ExecutorUtil.newMDCAwareFixedThreadPool(
multiShardUris.length, new SolrNamedThreadFactory("shardinstall"));
- final List<Future<Exception>> futures = executor.invokeAll(tasks, 10, TimeUnit.SECONDS);
- futures.stream()
- .forEach(
- future -> {
- assertTrue("Shard installation exceeded the test timeout", future.isDone());
- try {
- assertNull(
- "Expected shard installation to complete successfully but failed with exception "
- + future.get(),
- future.get());
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- });
-
- executor.shutdown();
- executor.awaitTermination(10, TimeUnit.SECONDS);
+ // TODO Reduce timeout once PR #1545 is merged to fix S3Mock slowness
+ final List<Future<Exception>> futures = executor.invokeAll(tasks, 30, TimeUnit.SECONDS);
+ try {
+ futures.stream()
+ .forEach(
+ future -> {
+ assertTrue("Shard installation exceeded the test timeout", future.isDone());
+ try {
+ assertFalse(
+ "Shard installation was cancelled after timing out.", future.isCancelled());
+ final Exception e = future.get();
+ assertNull("Shard installation failed with exception " + e, e);
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ });
+
+ executor.shutdown();
+ executor.awaitTermination(10, TimeUnit.SECONDS);
+ } finally {
+ executor.shutdownNow();
+ }
}
}