Do not test the ingest date processor against random locales.

Random locales include locales whose country name is obsolete like `CS` or have
usage restrictions like `DG`.

Closes #26425
This commit is contained in:
Adrien Grand 2017-08-30 09:46:37 +02:00
parent db54c4dc7c
commit 06b7f9c78e
1 changed files with 2 additions and 3 deletions

View File

@ -81,14 +81,13 @@ public class DateProcessorFactoryTests extends ESTestCase {
} }
} }
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/26425")
public void testParseLocale() throws Exception { public void testParseLocale() throws Exception {
DateProcessor.Factory factory = new DateProcessor.Factory(); DateProcessor.Factory factory = new DateProcessor.Factory();
Map<String, Object> config = new HashMap<>(); Map<String, Object> config = new HashMap<>();
String sourceField = randomAlphaOfLengthBetween(1, 10); String sourceField = randomAlphaOfLengthBetween(1, 10);
config.put("field", sourceField); config.put("field", sourceField);
config.put("formats", Collections.singletonList("dd/MM/yyyyy")); config.put("formats", Collections.singletonList("dd/MM/yyyyy"));
Locale locale = randomLocale(random()); Locale locale = randomFrom(Locale.GERMANY, Locale.FRENCH, Locale.ROOT);
config.put("locale", locale.toLanguageTag()); config.put("locale", locale.toLanguageTag());
DateProcessor processor = factory.create(null, null, config); DateProcessor processor = factory.create(null, null, config);
@ -96,7 +95,7 @@ public class DateProcessorFactoryTests extends ESTestCase {
} }
public void testParseInvalidLocale() throws Exception { public void testParseInvalidLocale() throws Exception {
String[] locales = new String[] { "invalid_locale", "english" }; String[] locales = new String[] { "invalid_locale", "english", "xy", "en-XY" };
for (String locale : locales) { for (String locale : locales) {
DateProcessor.Factory factory = new DateProcessor.Factory(); DateProcessor.Factory factory = new DateProcessor.Factory();
Map<String, Object> config = new HashMap<>(); Map<String, Object> config = new HashMap<>();