[TEST] add docs check to ScrollIdSigningTests
Original commit: elastic/x-pack-elasticsearch@30c026ac92
This commit is contained in:
parent
d9d5cbeb32
commit
b99f7be199
|
@ -19,6 +19,8 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
|
|
||||||
|
@ -54,16 +56,22 @@ public class ScrollIdSigningTests extends ShieldIntegrationTest {
|
||||||
.setScroll(TimeValue.timeValueMinutes(2))
|
.setScroll(TimeValue.timeValueMinutes(2))
|
||||||
.setSize(randomIntBetween(1, 10)).get();
|
.setSize(randomIntBetween(1, 10)).get();
|
||||||
|
|
||||||
|
assertHitCount(response, docs.length);
|
||||||
|
int hits = response.getHits().hits().length;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
assertSigned(response.getScrollId());
|
assertSigned(response.getScrollId());
|
||||||
while (true) {
|
while (true) {
|
||||||
response = client().prepareSearchScroll(response.getScrollId())
|
response = client().prepareSearchScroll(response.getScrollId())
|
||||||
.setScroll(TimeValue.timeValueMinutes(2)).get();
|
.setScroll(TimeValue.timeValueMinutes(2)).get();
|
||||||
assertSigned(response.getScrollId());
|
assertSigned(response.getScrollId());
|
||||||
|
assertHitCount(response, docs.length);
|
||||||
|
hits += response.getHits().hits().length;
|
||||||
if (response.getHits().getHits().length == 0) {
|
if (response.getHits().getHits().length == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assertThat(hits, equalTo(docs.length));
|
||||||
} finally {
|
} finally {
|
||||||
clearScroll(response.getScrollId());
|
clearScroll(response.getScrollId());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue