summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang Chen <chengpohi@gmail.com>2016-08-12 09:23:17 +0800
committerXiang Chen <chengpohi@gmail.com>2016-08-13 00:20:46 +0800
commit77f28dbdde3cd58a59711b32d080c2745370d4db (patch)
tree5cbf9d322cbcf13fd514807ea6e0330101020e25
parent15c96df5b5d5b22b13a27adb4650917fc6ad1d80 (diff)
fix CompletionSuggestion test failed caused by shard is 1
-rw-r--r--core/src/test/java/org/elasticsearch/search/suggest/completion/CompletionSuggestionTests.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/src/test/java/org/elasticsearch/search/suggest/completion/CompletionSuggestionTests.java b/core/src/test/java/org/elasticsearch/search/suggest/completion/CompletionSuggestionTests.java
index 1f2c14ba00..60722fb5f6 100644
--- a/core/src/test/java/org/elasticsearch/search/suggest/completion/CompletionSuggestionTests.java
+++ b/core/src/test/java/org/elasticsearch/search/suggest/completion/CompletionSuggestionTests.java
@@ -32,7 +32,6 @@ import static org.hamcrest.Matchers.lessThanOrEqualTo;
public class CompletionSuggestionTests extends ESTestCase {
- @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/19896")
public void testToReduce() throws Exception {
List<Suggest.Suggestion<CompletionSuggestion.Entry>> shardSuggestions = new ArrayList<>();
int nShards = randomIntBetween(1, 10);
@@ -47,8 +46,11 @@ public class CompletionSuggestionTests extends ESTestCase {
float maxScore = randomIntBetween(totalResults, totalResults*2);
for (int i = 0; i < totalResults; i++) {
Suggest.Suggestion<CompletionSuggestion.Entry> suggestion = randomFrom(shardSuggestions);
- suggestion.getEntries().get(0).addOption(new CompletionSuggestion.Entry.Option(i, new Text(""),
- maxScore - i, Collections.emptyMap()));
+ CompletionSuggestion.Entry entry = suggestion.getEntries().get(0);
+ if (entry.getOptions().size() < size) {
+ entry.addOption(new CompletionSuggestion.Entry.Option(i, new Text(""),
+ maxScore - i, Collections.emptyMap()));
+ }
}
CompletionSuggestion reducedSuggestion = CompletionSuggestion.reduceTo(shardSuggestions);
assertNotNull(reducedSuggestion);