test: sort by _uid to get consistent ordering

Original commit: elastic/x-pack-elasticsearch@73b5c49ea5
This commit is contained in:
jaymode 2016-03-01 09:30:12 -05:00
parent 507e9ede59
commit c8ee64d0cb
1 changed files with 3 additions and 0 deletions

View File

@ -8,6 +8,7 @@ package org.elasticsearch.integration;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.IndexModule; import org.elasticsearch.index.IndexModule;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.shield.Shield; import org.elasticsearch.shield.Shield;
import org.elasticsearch.shield.authc.support.Hasher; import org.elasticsearch.shield.authc.support.Hasher;
import org.elasticsearch.shield.authc.support.SecuredString; import org.elasticsearch.shield.authc.support.SecuredString;
@ -111,6 +112,7 @@ public class DocumentAndFieldLevelSecurityTests extends ShieldIntegTestCase {
response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user4", USERS_PASSWD))) response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user4", USERS_PASSWD)))
.prepareSearch("test") .prepareSearch("test")
.addSort("_uid", SortOrder.ASC)
.get(); .get();
assertHitCount(response, 2); assertHitCount(response, 2);
assertSearchHits(response, "1", "2"); assertSearchHits(response, "1", "2");
@ -163,6 +165,7 @@ public class DocumentAndFieldLevelSecurityTests extends ShieldIntegTestCase {
response = client().filterWithHeader( response = client().filterWithHeader(
Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user4", USERS_PASSWD))) Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user4", USERS_PASSWD)))
.prepareSearch("test") .prepareSearch("test")
.addSort("_uid", SortOrder.ASC)
.get(); .get();
assertHitCount(response, 2); assertHitCount(response, 2);
assertThat(response.getHits().getAt(0).getId(), equalTo("1")); assertThat(response.getHits().getAt(0).getId(), equalTo("1"));