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

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


The following commit(s) were added to refs/heads/main by this push:
     new d63d316  SOLR-15676, SOLR-15687: make UpdateLogCloudTest repeatable 
(via @Before and @After) (#341)
d63d316 is described below

commit d63d316c65afaa93f177f7175455d1c7d029f334
Author: Christine Poerschke <[email protected]>
AuthorDate: Mon Oct 18 09:37:29 2021 +0100

    SOLR-15676, SOLR-15687: make UpdateLogCloudTest repeatable (via @Before and 
@After) (#341)
---
 .../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 {
 

Reply via email to