You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2020/10/13 16:40:49 UTC

[lucene-solr] branch reference_impl_dev updated: More un-ignore in the solrj

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

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


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new 1d1f83e  More un-ignore in the solrj
1d1f83e is described below

commit 1d1f83ead6fa94d5efa7f9be22a2ee544aa00225
Author: Timothy Potter <th...@gmail.com>
AuthorDate: Tue Oct 13 10:33:52 2020 -0600

    More un-ignore in the solrj
---
 .../processor/DistributedZkUpdateProcessor.java    |  2 --
 .../processor/TolerantUpdateProcessorFactory.java  |  2 +-
 .../solr/client/solrj/impl/LBHttp2SolrClient.java  |  8 +++++++
 .../solrj/impl/CloudHttp2SolrClientRetryTest.java  |  9 +++++--
 .../solrj/impl/CloudHttp2SolrClientTest.java       |  2 --
 .../solrj/impl/CloudSolrClientRetryTest.java       | 11 +++++----
 .../solrj/impl/LBHttpSolrClientBadInputTest.java   |  2 --
 .../solr/client/solrj/request/SchemaTest.java      | 28 ++++++++--------------
 8 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
index 1ec2318..7c4557f 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
@@ -282,8 +282,6 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
   public void processAdd(AddUpdateCommand cmd) throws IOException {
     clusterState = zkController.getClusterState();
 
-    assert TestInjection.injectFailUpdateRequests();
-
     if (isReadOnly()) {
       throw new SolrException(ErrorCode.FORBIDDEN, "Collection " + collection + " is read-only.");
     }
diff --git a/solr/core/src/java/org/apache/solr/update/processor/TolerantUpdateProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/TolerantUpdateProcessorFactory.java
index fc46ecc..886e025 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/TolerantUpdateProcessorFactory.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/TolerantUpdateProcessorFactory.java
@@ -133,7 +133,7 @@ public class TolerantUpdateProcessorFactory extends UpdateRequestProcessorFactor
     DistributedUpdateProcessorFactory.addParamToDistributedRequestWhitelist(req, MAX_ERRORS_PARAM);
     int maxErrors = req.getParams().getInt(MAX_ERRORS_PARAM, defaultMaxErrors);
     if (maxErrors < -1) {
-      throw new SolrException(ErrorCode.BAD_REQUEST, "'"+MAX_ERRORS_PARAM + "' must either be non-negative, or -1 to indicate 'unlimiited': " + maxErrors);
+      throw new SolrException(ErrorCode.BAD_REQUEST, "'"+MAX_ERRORS_PARAM + "' must either be non-negative, or -1 to indicate 'unlimited': " + maxErrors);
     }
 
     // NOTE: even if 0==maxErrors, we still inject processor into chain so responses has expected header info
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java
index 4b60c9b..ac3a06b 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java
@@ -93,6 +93,14 @@ public class LBHttp2SolrClient extends LBSolrClient {
   }
 
   @Override
+  public void close() {
+    if (closeClient) {
+      httpClient.close();
+    }
+    super.close();
+  }
+
+  @Override
   protected SolrClient getClient(String baseUrl) {
     return httpClient;
   }
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java
index b24748d..c737fe1 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java
@@ -22,6 +22,7 @@ import java.util.Optional;
 
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.cloud.SolrCloudTestCase;
 import org.apache.solr.common.SolrInputDocument;
@@ -33,7 +34,7 @@ import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 
-@Ignore // nocommit debug
+@Ignore // nocommit ~ still a bit flakey when run in the suite, usually passes in the IDE though
 public class CloudHttp2SolrClientRetryTest extends SolrCloudTestCase {
   private static final int NODE_COUNT = 1;
 
@@ -69,7 +70,11 @@ public class CloudHttp2SolrClientRetryTest extends SolrCloudTestCase {
       try {
         expectThrows(BaseCloudSolrClient.RouteException.class,
             "Expected an exception on the client when failure is injected during updates", () -> {
-              solrClient.add(collectionName, new SolrInputDocument("id", "2"));
+              UpdateRequest req = new UpdateRequest();
+              req.add(new SolrInputDocument("id", "2"));
+              req.setCommitWithin(-1);
+              req.setParam("maxErrors", "0"); // nocommit: did the default change for single doc adds?
+              req.process(solrClient, collectionName);
             });
       } finally {
         TestInjection.reset();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
index dd18f53..0a3be12 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
@@ -624,7 +624,6 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
   }
 
   @Test
-  @Ignore // nocommit ~ hangs, possibly related to creating collections with processAsync
   public void checkCollectionParameters() throws Exception {
 
     try (CloudSolrClient client = SolrTestCaseJ4.getCloudSolrClient(cluster.getZkServer().getZkAddress())) {
@@ -785,7 +784,6 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
   }
 
   @Test
-  @Ignore // nocommit - this was flakey, no failing consistently with wrong number of versions returned
   public void testVersionsAreReturned() throws Exception {
     CollectionAdminRequest.createCollection("versions_collection", "conf", 2, 1).process(cluster.getSolrClient());
     
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientRetryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientRetryTest.java
index c4bda26..1fdde15 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientRetryTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientRetryTest.java
@@ -19,6 +19,7 @@ package org.apache.solr.client.solrj.impl;
 
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.cloud.SolrCloudTestCase;
 import org.apache.solr.common.SolrInputDocument;
@@ -27,10 +28,8 @@ import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.util.TestInjection;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
-@Ignore // nocommit debug
 public class CloudSolrClientRetryTest extends SolrCloudTestCase {
   private static final int NODE_COUNT = 1;
 
@@ -64,9 +63,13 @@ public class CloudSolrClientRetryTest extends SolrCloudTestCase {
 
     TestInjection.failUpdateRequests = "true:100";
     try {
-      expectThrows(CloudSolrClient.RouteException.class,
+      expectThrows(BaseCloudSolrClient.RouteException.class,
           "Expected an exception on the client when failure is injected during updates", () -> {
-            solrClient.add(collectionName, new SolrInputDocument("id", "2"));
+            UpdateRequest req = new UpdateRequest();
+            req.add(new SolrInputDocument("id", "2"));
+            req.setCommitWithin(-1);
+            req.setParam("maxErrors", "0"); // nocommit: did the default change for single doc adds?
+            req.process(solrClient, collectionName);
           });
     } finally {
       TestInjection.reset();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java
index 9d29d3d..47f9c73 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java
@@ -27,12 +27,10 @@ import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.embedded.JettyConfig;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import static org.hamcrest.core.StringContains.containsString;
 
-@Ignore // nocommit investigate, hangs/leaks
 public class LBHttpSolrClientBadInputTest extends SolrJettyTestBase {
   private static final List<String> NULL_STR_LIST = null;
   private static final List<String> EMPTY_STR_LIST = new ArrayList<>();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
index 8aef0a0..947894c 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
@@ -43,11 +43,8 @@ import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SimpleOrderedMap;
 import org.apache.solr.util.RestTestBase;
 import org.eclipse.jetty.servlet.ServletHolder;
-import org.junit.After;
 import org.junit.AfterClass;
-import org.junit.Before;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.anyOf;
@@ -338,11 +335,10 @@ public class SchemaTest extends RestTestBase {
   }
 
   @Test
-  @Ignore // nocommit TODO extrac to test that resets in Before/After
   public void testReplaceFieldAccuracy() throws Exception {
     // Given
     Map<String, Object> fieldAttributes = new LinkedHashMap<>();
-    String fieldName = "accuracyField";
+    String fieldName = "accuracyFieldReplace";
     fieldAttributes.put("name", fieldName);
     fieldAttributes.put("type", "string");
     fieldAttributes.put("stored", false);
@@ -494,7 +490,6 @@ public class SchemaTest extends RestTestBase {
   }
 
   @Test
-  @Ignore // nocommit TODO extrac to test that resets in Before/After
   public void testAddFieldTypeAccuracy() throws Exception {
     SchemaRequest.FieldTypes fieldTypesRequest = new SchemaRequest.FieldTypes();
     SchemaResponse.FieldTypesResponse initialFieldTypesResponse = fieldTypesRequest.process(getSolrClient(jetty));
@@ -503,7 +498,7 @@ public class SchemaTest extends RestTestBase {
 
     FieldTypeDefinition fieldTypeDefinition = new FieldTypeDefinition();
     Map<String, Object> fieldTypeAttributes = new LinkedHashMap<>();
-    String fieldTypeName = "accuracyTextField";
+    String fieldTypeName = "accuracyTextFieldAdd";
     fieldTypeAttributes.put("name", fieldTypeName);
     fieldTypeAttributes.put("class", "solr.TextField");
     fieldTypeAttributes.put("positionIncrementGap", "100");
@@ -535,7 +530,7 @@ public class SchemaTest extends RestTestBase {
     assertEquals(initialFieldTypes.size() + 1, currentFieldTypes.size());
 
     Map<String, Object> fieldAttributes = new LinkedHashMap<>();
-    String fieldName = "accuracyField";
+    String fieldName = "accuracyFieldAdd";
     fieldAttributes.put("name", fieldName);
     fieldAttributes.put("type", fieldTypeName);
     SchemaRequest.AddField addFieldRequest =
@@ -741,14 +736,13 @@ public class SchemaTest extends RestTestBase {
   }
 
   @Test
-  @Ignore // nocommit TODO extrac to test that resets in Before/After
   public void testCopyFieldAccuracy() throws Exception {
     SchemaRequest.CopyFields copyFieldsSchemaRequest = new SchemaRequest.CopyFields();
     SchemaResponse.CopyFieldsResponse initialCopyFieldsResponse = copyFieldsSchemaRequest.process(getSolrClient(jetty));
     List<Map<String, Object>> initialCopyFieldsAttributes = initialCopyFieldsResponse.getCopyFields();
 
-    String srcFieldName = "copyfield";
-    String destFieldName1 = "destField1", destFieldName2 = "destField2";
+    String srcFieldName = "copyfieldZ";
+    String destFieldName1 = "destField1Z", destFieldName2 = "destField2Z";
     createStoredStringField(srcFieldName, getSolrClient(jetty));
     createStoredStringField(destFieldName1, getSolrClient(jetty));
     createStoredStringField(destFieldName2, getSolrClient(jetty));
@@ -765,14 +759,13 @@ public class SchemaTest extends RestTestBase {
   }
 
   @Test
-  @Ignore // nocommit TODO extrac to test that resets in Before/After
   public void testCopyFieldWithMaxCharsAccuracy() throws Exception {
     SchemaRequest.CopyFields copyFieldsSchemaRequest = new SchemaRequest.CopyFields();
     SchemaResponse.CopyFieldsResponse initialCopyFieldsResponse = copyFieldsSchemaRequest.process(getSolrClient(jetty));
     List<Map<String, Object>> initialCopyFieldsAttributes = initialCopyFieldsResponse.getCopyFields();
 
-    String srcFieldName = "copyfield";
-    String destFieldName1 = "destField1", destFieldName2 = "destField2";
+    String srcFieldName = "copyfieldMaxChars";
+    String destFieldName1 = "destField1MaxChars", destFieldName2 = "destField2MaxChars";
     createStoredStringField(srcFieldName, getSolrClient(jetty));
     createStoredStringField(destFieldName1, getSolrClient(jetty));
     createStoredStringField(destFieldName2, getSolrClient(jetty));
@@ -844,13 +837,12 @@ public class SchemaTest extends RestTestBase {
   }
 
   @Test
-  @Ignore // nocommit TODO extrac to test that resets in Before/After
   public void testMultipleUpdateRequestAccuracy() throws Exception {
-    String fieldTypeName = "accuracyTextField";
+    String fieldTypeName = "accuracyTextFieldMulti";
     SchemaRequest.AddFieldType addFieldTypeRequest = createFieldTypeRequest(fieldTypeName);
 
-    String field1Name = "accuracyField1";
-    String field2Name = "accuracyField2";
+    String field1Name = "accuracyField1Multi";
+    String field2Name = "accuracyField2Multi";
     Map<String, Object> fieldAttributes = new LinkedHashMap<>();
     fieldAttributes.put("name", field1Name);
     fieldAttributes.put("type", fieldTypeName);