[TEST] added debug lines to bw comp testDeleteByQuery and testDeleteRoutingRequired

This commit is contained in:
javanna 2014-08-21 13:10:32 +02:00 committed by Luca Cavanna
parent f1a6b4e9fe
commit c89f941ffa
1 changed files with 14 additions and 3 deletions

View File

@ -77,8 +77,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.index.query.FilterBuilders.existsFilter; import static org.elasticsearch.index.query.FilterBuilders.existsFilter;
import static org.elasticsearch.index.query.FilterBuilders.missingFilter; import static org.elasticsearch.index.query.FilterBuilders.missingFilter;
import static org.elasticsearch.index.query.QueryBuilders.*; import static org.elasticsearch.index.query.QueryBuilders.*;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
/** /**
@ -573,6 +572,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa
indexRandom(true, indexRequestBuilders); indexRandom(true, indexRequestBuilders);
SearchResponse searchResponse = client().prepareSearch("test").get(); SearchResponse searchResponse = client().prepareSearch("test").get();
assertNoFailures(searchResponse);
assertThat(searchResponse.getHits().totalHits(), equalTo((long)numDocs + 1)); assertThat(searchResponse.getHits().totalHits(), equalTo((long)numDocs + 1));
DeleteByQueryResponse deleteByQueryResponse = client().prepareDeleteByQuery("test").setQuery(QueryBuilders.termQuery("field", "value")).get(); DeleteByQueryResponse deleteByQueryResponse = client().prepareDeleteByQuery("test").setQuery(QueryBuilders.termQuery("field", "value")).get();
@ -584,6 +584,10 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa
refresh(); refresh();
searchResponse = client().prepareSearch("test").get(); searchResponse = client().prepareSearch("test").get();
assertNoFailures(searchResponse);
for (SearchHit searchHit : searchResponse.getHits()) {
logger.debug("searchHit {}/{}/{}", searchHit.getIndex(), searchHit.getType(), searchHit.getId());
}
assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l));
} }
@ -610,6 +614,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa
indexRandom(true, indexRequestBuilders); indexRandom(true, indexRequestBuilders);
SearchResponse searchResponse = client().prepareSearch("test").get(); SearchResponse searchResponse = client().prepareSearch("test").get();
assertNoFailures(searchResponse);
assertThat(searchResponse.getHits().totalHits(), equalTo((long) numDocs)); assertThat(searchResponse.getHits().totalHits(), equalTo((long) numDocs));
//use routing //use routing
@ -619,15 +624,21 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa
assertThat(getResponse.isExists(), equalTo(false)); assertThat(getResponse.isExists(), equalTo(false));
refresh(); refresh();
searchResponse = client().prepareSearch("test").get(); searchResponse = client().prepareSearch("test").get();
assertNoFailures(searchResponse);
assertThat(searchResponse.getHits().totalHits(), equalTo((long) numDocs - 1)); assertThat(searchResponse.getHits().totalHits(), equalTo((long) numDocs - 1));
//don't use routing and trigger a broadcast delete //don't use routing and trigger a broadcast delete
deleteResponse = client().prepareDelete("test", "test", secondDocId).get(); deleteResponse = client().prepareDelete("test", "test", secondDocId).get();
assertThat(deleteResponse.isFound(), equalTo(true)); assertThat(deleteResponse.isFound(), equalTo(true));
getResponse = client().prepareGet("test", "test", secondDocId).setRouting(secondRouting).get(); getResponse = client().prepareGet("test", "test", secondDocId).setRouting(secondRouting).get();
assertThat(getResponse.isExists(), equalTo(false)); assertThat(getResponse.isExists(), equalTo(false));
refresh(); refresh();
searchResponse = client().prepareSearch("test").get(); searchResponse = client().prepareSearch("test").setSize(numDocs).get();
assertNoFailures(searchResponse);
for (SearchHit searchHit : searchResponse.getHits()) {
logger.debug("searchHit {}/{}/{}", searchHit.getIndex(), searchHit.getType(), searchHit.getId());
}
assertThat(searchResponse.getHits().totalHits(), equalTo((long) numDocs - 2)); assertThat(searchResponse.getHits().totalHits(), equalTo((long) numDocs - 2));
} }