Skip to content

Commit 6dd5c80

Browse files
committed
Fixed test bug, was using value that wasn't generated.
1 parent bcfba8b commit 6dd5c80

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/test/java/org/elasticsearch/percolator/PercolatorTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,7 @@ public void testPercolateScoreAndSorting() throws Exception {
11451145
}
11461146
controlMap.get(value).add(i);
11471147
}
1148+
List<Integer> usedValues = new ArrayList<Integer>(controlMap.keySet());
11481149
refresh();
11491150

11501151
// Only retrieve the score
@@ -1166,7 +1167,6 @@ public void testPercolateScoreAndSorting() throws Exception {
11661167
}
11671168

11681169
// Sort the queries by the score
1169-
runs = randomInt(27);
11701170
for (int i = 0; i < runs; i++) {
11711171
int size = randomIntBetween(1, 10);
11721172
PercolateResponse response = client().preparePercolate().setIndices("my-index").setDocumentType("my-type")
@@ -1188,9 +1188,8 @@ public void testPercolateScoreAndSorting() throws Exception {
11881188
}
11891189

11901190

1191-
runs = randomInt(27);
11921191
for (int i = 0; i < runs; i++) {
1193-
int value = randomInt(10);
1192+
int value = usedValues.get(randomInt(usedValues.size() - 1));
11941193
NavigableSet<Integer> levels = controlMap.get(value);
11951194
int size = randomIntBetween(1, levels.size());
11961195
PercolateResponse response = client().preparePercolate().setIndices("my-index").setDocumentType("my-type")

0 commit comments

Comments
 (0)