[TEST] Fix ExistsMissingTests failures.

They were due to a combination of mappings propagation delays and the behavior
of MapperService.smartName(String) so mappings are now configured up-front.
This commit is contained in:
Adrien Grand 2014-07-01 11:24:19 +02:00
parent 60a8515fb7
commit 6a1e7b6ad0
1 changed files with 31 additions and 11 deletions

View File

@ -29,11 +29,7 @@ import org.elasticsearch.index.query.FilterBuilders;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Locale;
import java.util.*;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
@ -44,15 +40,39 @@ public class ExistsMissingTests extends ElasticsearchIntegrationTest {
public void testExistsMissing() throws Exception {
XContentBuilder mapping = XContentBuilder.builder(JsonXContent.jsonXContent)
.startObject()
.startObject()
.startObject("type")
.startObject(FieldNamesFieldMapper.NAME)
.startObject(FieldNamesFieldMapper.NAME)
// by setting randomly index to no we also test the pre-1.3 behavior
.field("index", randomFrom("no", "not_analyzed"))
.field("store", randomFrom("no", "yes"))
.field("index", randomFrom("no", "not_analyzed"))
.field("store", randomFrom("no", "yes"))
.endObject()
.startObject("properties")
.startObject("foo")
.field("type", "string")
.endObject()
.startObject("bar")
.field("type", "object")
.startObject("properties")
.startObject("foo")
.field("type", "string")
.endObject()
.startObject("bar")
.field("type", "object")
.startObject("properties")
.startObject("bar")
.field("type", "string")
.endObject()
.endObject()
.endObject()
.startObject("baz")
.field("type", "long")
.endObject()
.endObject()
.endObject()
.endObject()
.endObject()
.endObject()
.endObject();
.endObject();
assertAcked(client().admin().indices().prepareCreate("idx").addMapping("type", mapping));
@SuppressWarnings("unchecked")