From f00964e7dbe09fa4e1cf424146e1dd904415858d Mon Sep 17 00:00:00 2001 From: "Chris M. Hostetter" Date: Fri, 24 Jul 2015 17:34:08 +0000 Subject: [PATCH] SOLR-7804: Fix test bug where it was randomly generating 2 identical facet.pivot params w/o realizing it git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1692552 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/org/apache/solr/cloud/TestCloudPivotFacet.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudPivotFacet.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudPivotFacet.java index 60c95b550f6..879385aa4ed 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestCloudPivotFacet.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudPivotFacet.java @@ -39,6 +39,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.Date; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -165,11 +166,15 @@ public class TestCloudPivotFacet extends AbstractFullDistribZkTestBase { } ModifiableSolrParams pivotP = params(FACET,"true"); - pivotP.add(FACET_PIVOT, buildPivotParamValue(buildRandomPivot(fieldNames))); + + // put our FACET_PIVOT params in a set in case we just happen to pick the same one twice + LinkedHashSet pivotParamValues = new LinkedHashSet(); + pivotParamValues.add(buildPivotParamValue(buildRandomPivot(fieldNames))); if (random().nextBoolean()) { - pivotP.add(FACET_PIVOT, buildPivotParamValue(buildRandomPivot(fieldNames))); + pivotParamValues.add(buildPivotParamValue(buildRandomPivot(fieldNames))); } + pivotP.set(FACET_PIVOT, pivotParamValues.toArray(new String[pivotParamValues.size()])); // keep limit low - lots of unique values, and lots of depth in pivots pivotP.add(FACET_LIMIT, ""+TestUtil.nextInt(random(),1,17));