You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2021/10/18 09:51:40 UTC

[lucene-solr] 02/02: SOLR-15676, SOLR-15687: make UpdateLogCloudTest repeatable (via @Before and @After) (#341)

This is an automated email from the ASF dual-hosted git repository.

cpoerschke pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 277e1e064559117ccbc3004be88160bf24380d55
Author: Christine Poerschke <cp...@apache.org>
AuthorDate: Mon Oct 18 09:37:29 2021 +0100

    SOLR-15676, SOLR-15687: make UpdateLogCloudTest repeatable (via @Before and @After) (#341)
    
    (cherry picked from commit d63d316c65afaa93f177f7175455d1c7d029f334)
---
 .../solr/handler/component/UpdateLogCloudTest.java   | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/handler/component/UpdateLogCloudTest.java b/solr/core/src/test/org/apache/solr/handler/component/UpdateLogCloudTest.java
index 010fda2..9868657 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/UpdateLogCloudTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/UpdateLogCloudTest.java
@@ -29,6 +29,8 @@ import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.cloud.AbstractDistribZkTestBase;
 import org.apache.solr.cloud.SolrCloudTestCase;
 import org.apache.solr.common.util.NamedList;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -40,14 +42,17 @@ public class UpdateLogCloudTest extends SolrCloudTestCase {
 
   @BeforeClass
   public static void setupCluster() throws Exception {
-
-    // decide collection name ...
-    COLLECTION = "collection"+(1+random().nextInt(100)) ;
-
     // create and configure cluster
     configureCluster(NUM_SHARDS*NUM_REPLICAS /* nodeCount */)
     .addConfig("conf", configset("cloud-dynamic"))
     .configure();
+  }
+
+  @Before
+  public void beforeTest() throws Exception {
+
+    // decide collection name ...
+    COLLECTION = "collection"+(1+random().nextInt(100)) ;
 
     // create an empty collection
     CollectionAdminRequest
@@ -56,6 +61,13 @@ public class UpdateLogCloudTest extends SolrCloudTestCase {
     AbstractDistribZkTestBase.waitForRecoveriesToFinish(COLLECTION, cluster.getSolrClient().getZkStateReader(), false, true, DEFAULT_TIMEOUT);
   }
 
+  @After
+  public void afterTest() throws Exception {
+    CollectionAdminRequest
+    .deleteCollection(COLLECTION)
+    .process(cluster.getSolrClient());
+  }
+
   @Test
   public void test() throws Exception {