You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gu...@apache.org on 2019/02/19 14:53:39 UTC

[lucene-solr] 02/09: SOLR-13150: improve assertions for CRA max cardinality test

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

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

commit f1ed5750e5c7007bc7008311ad9504a72b5f92f7
Author: internet <in...@localhost.localdomain>
AuthorDate: Sun Feb 17 08:59:58 2019 +0200

    SOLR-13150: improve assertions for CRA max cardinality test
---
 .../update/processor/CategoryRoutedAliasUpdateProcessorTest.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java
index 3df7784..9cd44fc 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java
@@ -223,7 +223,7 @@ public class CategoryRoutedAliasUpdateProcessorTest extends RoutedAliasUpdatePro
     String configName = getSaferTestName();
     createConfigSet(configName);
 
-    final int maxCardinality = 2;
+    final int maxCardinality = 2; // max cardinality for current test
 
     // Start with one collection manually created (and use higher numShards & replicas than we'll use for others)
     //  This tests we may pre-create the collection and it's acceptable.
@@ -242,7 +242,7 @@ public class CategoryRoutedAliasUpdateProcessorTest extends RoutedAliasUpdatePro
 
     CollectionAdminRequest.createCategoryRoutedAlias(getAlias(), categoryField,
         CollectionAdminRequest.createCollection("_unused_", configName, 1, 1)
-            .setMaxShardsPerNode(2)).setMaxCardinality(2)
+            .setMaxShardsPerNode(2)).setMaxCardinality(maxCardinality)
         .process(solrClient);
 
     // now we index a document
@@ -257,7 +257,8 @@ public class CategoryRoutedAliasUpdateProcessorTest extends RoutedAliasUpdatePro
     assertInvariants(colVogon, colHoG);
 
     // should fail since max cardinality is reached
-    Throwable e = expectThrows(Throwable.class, () -> addDocsAndCommit(true, newDoc(SHIPS[2])));
+    SolrException e = expectThrows(SolrException.class, () ->
+        solrClient.add(getAlias(), Collections.singleton(newDoc(SHIPS[2])), -1));
     assertTrue("update should fail because CRA max cardinality is reached",
         e.getMessage().contains("max cardinality can not be exceeded for a Category Routed Alias"));
     --lastDocId; // since last doc was not indexed