public void testConcurrentCreateAndDeleteDoesNotFail() {
    final File configDir = getFile("solr").toPath().resolve("configsets/configset-2/conf").toFile();
    final AtomicReference<Exception> failure = new AtomicReference<>();
    final int timeToRunSec = 30;
    final Thread[] threads = new Thread[10];
    for (int i = 0; i < threads.length; i++) {
      final String collectionName = "collection" + i;
      uploadConfig(configDir, collectionName);
      final SolrClient solrClient =
          new HttpSolrClient(solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString());
      threads[i] =
          new CreateDeleteSearchCollectionThread(
              "create-delete-search-" + i,
              collectionName,
              collectionName,
              timeToRunSec,
              solrClient,
              failure);
    }

    startAll(threads);
    joinAll(threads);

    assertNull("concurrent create and delete collection failed: " + failure.get(), failure.get());
  }
  public void testConcurrentCreateAndDeleteOverTheSameConfig() {
    final String configName = "testconfig";
    final File configDir = getFile("solr").toPath().resolve("configsets/configset-2/conf").toFile();
    uploadConfig(configDir, configName); // upload config once, to be used by all collections
    final SolrClient solrClient =
        new HttpSolrClient(solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString());
    final AtomicReference<Exception> failure = new AtomicReference<>();
    final int timeToRunSec = 30;
    final Thread[] threads = new Thread[2];
    for (int i = 0; i < threads.length; i++) {
      final String collectionName = "collection" + i;
      threads[i] =
          new CreateDeleteCollectionThread(
              "create-delete-" + i, collectionName, configName, timeToRunSec, solrClient, failure);
    }

    startAll(threads);
    joinAll(threads);

    assertNull("concurrent create and delete collection failed: " + failure.get(), failure.get());

    try {
      solrClient.close();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
 /**
  * Sets the tracking queue for all nodes participating in this cluster. Once this method returns,
  * all search and core admin requests distributed to shards will be submitted to the given queue.
  *
  * <p>This is equivalent to calling: <code>
  * TrackingShardHandlerFactory.setTrackingQueue(cluster.getJettySolrRunners(), queue)</code>
  *
  * @see
  *     org.apache.solr.handler.component.TrackingShardHandlerFactory#setTrackingQueue(java.util.List,
  *     java.util.Queue)
  */
 public static void setTrackingQueue(
     MiniSolrCloudCluster cluster, Queue<ShardRequestAndParams> queue) {
   setTrackingQueue(cluster.getJettySolrRunners(), queue);
 }