[TEST] added debug info to GeoBoundsTests to try to solve build issue
This commit is contained in:
parent
aadbfa44b4
commit
12ca36574e
|
@ -24,10 +24,13 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.util.BigArray;
|
||||
import org.elasticsearch.search.SearchHitField;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket;
|
||||
import org.elasticsearch.search.aggregations.metrics.geobounds.GeoBounds;
|
||||
import org.elasticsearch.search.aggregations.metrics.geobounds.GeoBoundsAggregator;
|
||||
import org.elasticsearch.search.sort.SortBuilders;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -145,6 +148,18 @@ public class GeoBoundsTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
indexRandom(true, builders);
|
||||
ensureSearchable();
|
||||
|
||||
// Added to debug a test failure (Dev issue #266) where the terms aggregation seems to be reporting two documents with the same value for NUMBER_FIELD_NAME. This will chaeck that after
|
||||
// random indexing each document only has 1 value for NUMBER_FIELD_NAME and it is the correct value
|
||||
SearchResponse response = client().prepareSearch("high_card_idx").addField(NUMBER_FIELD_NAME).addSort(SortBuilders.fieldSort(NUMBER_FIELD_NAME).order(SortOrder.ASC)).setSize(5000).get();
|
||||
assertSearchResponse(response);
|
||||
assertThat(response.getHits().totalHits(), equalTo(2000l));
|
||||
for (int i = 0; i < 2000; i++) {
|
||||
SearchHitField hitField = response.getHits().getAt(i).field(NUMBER_FIELD_NAME);
|
||||
assertThat("Hit " + i + " has wrong number of values", hitField.getValues().size(), equalTo(1));
|
||||
Integer value = hitField.getValue();
|
||||
assertThat("Hit " + i + " has wrong value", value, equalTo(i));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBoundsBottomRight(GeoPoint geoPoint, GeoPoint currentBound) {
|
||||
|
@ -335,7 +350,7 @@ public class GeoBoundsTests extends ElasticsearchIntegrationTest {
|
|||
for (int i = 0; i < 10; i++) {
|
||||
Bucket bucket = buckets.get(i);
|
||||
assertThat(bucket, notNullValue());
|
||||
assertThat(bucket.getDocCount(), equalTo(1l));
|
||||
assertThat("Bucket " + bucket.getKey() + " has wrong number of documents", bucket.getDocCount(), equalTo(1l));
|
||||
GeoBounds geoBounds = bucket.getAggregations().get("geoBounds");
|
||||
assertThat(geoBounds, notNullValue());
|
||||
assertThat(geoBounds.getName(), equalTo("geoBounds"));
|
||||
|
|
Loading…
Reference in New Issue