From 1010e1e5436e275cb43bee04e17d0c3d4b574175 Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Thu, 17 Mar 2016 13:48:54 -0400 Subject: [PATCH] [TEST] Make test less fragile by sorting only on _uid The previous method sorted first by _score, then _uid. In certain situations, this allowed floating point errors to slightly alter the sort order, causing test failure. We only sort on _uid now, which should be deterministic and allow comparison of ten documents. Not quite as useful, but less fragile and we still check to make sure num hits and max score are identical. Closes #17164 --- .../java/org/elasticsearch/search/profile/QueryProfilerIT.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/search/profile/QueryProfilerIT.java b/core/src/test/java/org/elasticsearch/search/profile/QueryProfilerIT.java index f5507504586..d9878774576 100644 --- a/core/src/test/java/org/elasticsearch/search/profile/QueryProfilerIT.java +++ b/core/src/test/java/org/elasticsearch/search/profile/QueryProfilerIT.java @@ -131,7 +131,6 @@ public class QueryProfilerIT extends ESIntegTestCase { SearchRequestBuilder vanilla = client().prepareSearch("test") .setQuery(q) .setProfile(false) - .addSort("_score", SortOrder.DESC) .addSort("_uid", SortOrder.ASC) .setPreference("_primary") .setSearchType(SearchType.QUERY_THEN_FETCH); @@ -139,7 +138,6 @@ public class QueryProfilerIT extends ESIntegTestCase { SearchRequestBuilder profile = client().prepareSearch("test") .setQuery(q) .setProfile(true) - .addSort("_score", SortOrder.DESC) .addSort("_uid", SortOrder.ASC) .setPreference("_primary") .setSearchType(SearchType.QUERY_THEN_FETCH);