Skip to content

Commit

Permalink
Fix test bug in DynamicMappingsIT. (elastic#37906)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpountz authored Feb 1, 2019
1 parent 2758578 commit d83c748
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.InternalSettingsPlugin;
import org.hamcrest.Matchers;

import java.io.IOException;
import java.util.Collection;
Expand All @@ -41,7 +42,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(InternalSettingsPlugin.class);
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37898")
public void testConflictingDynamicMappings() {
// we don't use indexRandom because the order of requests is important here
createIndex("index");
Expand All @@ -50,7 +50,15 @@ public void testConflictingDynamicMappings() {
client().prepareIndex("index", "type", "2").setSource("foo", "bar").get();
fail("Indexing request should have failed!");
} catch (MapperParsingException e) {
// expected
// general case, the parsing code complains that it can't parse "bar" as a "long"
assertThat(e.getMessage(),
Matchers.containsString("failed to parse field [foo] of type [long]"));
} catch (IllegalArgumentException e) {
// rare case: the node that processes the index request doesn't have the mappings
// yet and sends a mapping update to the master node to map "bar" as "text". This
// fails as it had been already mapped as a long by the previous index request.
assertThat(e.getMessage(),
Matchers.containsString("mapper [foo] of different type, current_type [long], merged_type [text]"));
}
}

Expand Down

0 comments on commit d83c748

Please sign in to comment.