Fixing occasional test failure in RankEvalSpecTests
This commit is contained in:
parent
3348d2317f
commit
fdb24cd3e4
|
@ -262,11 +262,12 @@ public class RankEvalSpec implements Writeable, ToXContentObject {
|
|||
return Objects.equals(ratedRequests, other.ratedRequests) &&
|
||||
Objects.equals(metric, other.metric) &&
|
||||
Objects.equals(maxConcurrentSearches, other.maxConcurrentSearches) &&
|
||||
Objects.equals(templates, other.templates);
|
||||
Objects.equals(templates, other.templates) &&
|
||||
Objects.equals(indices, other.indices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return Objects.hash(ratedRequests, metric, templates, maxConcurrentSearches);
|
||||
return Objects.hash(ratedRequests, metric, templates, maxConcurrentSearches, indices);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,9 @@ public class RankEvalSpecTests extends ESTestCase {
|
|||
try (XContentParser parser = createParser(JsonXContent.jsonXContent, shuffled.bytes())) {
|
||||
|
||||
RankEvalSpec parsedItem = RankEvalSpec.parse(parser);
|
||||
// IRL these come from URL parameters - see RestRankEvalAction
|
||||
// indices, come from URL parameters, so they don't survive xContent roundtrip
|
||||
// for the sake of being able to use equals() next, we add it to the parsed object
|
||||
parsedItem.addIndices(testItem.getIndices());
|
||||
assertNotSame(testItem, parsedItem);
|
||||
assertEquals(testItem, parsedItem);
|
||||
assertEquals(testItem.hashCode(), parsedItem.hashCode());
|
||||
|
@ -142,7 +144,7 @@ public class RankEvalSpecTests extends ESTestCase {
|
|||
private static RankEvalSpec mutateTestItem(RankEvalSpec original) {
|
||||
List<RatedRequest> ratedRequests = new ArrayList<>(original.getRatedRequests());
|
||||
EvaluationMetric metric = original.getMetric();
|
||||
Map<String, Script> templates = original.getTemplates();
|
||||
Map<String, Script> templates = new HashMap<>(original.getTemplates());
|
||||
List<String> indices = new ArrayList<>(original.getIndices());
|
||||
|
||||
int mutate = randomIntBetween(0, 3);
|
||||
|
|
Loading…
Reference in New Issue