Disable date parsing test in non english locale (#39052)
This ensures we do not attempt to parse non english locale dates in FIPS mode. The error, originally assumed to affect only Joda, affects Java time in the same manner and manifests only with the version of BouncyCastle FIPS certified provider we use in tests. The upstream issue https://github.com/bcgit/bc-java/issues/405 indicates that the behavior is resolved in later versions of the BouncyCastle library and should be tested again when the new versions become FIPS 140 certified
This commit is contained in:
parent
f5b28ca69d
commit
ec2b64af63
|
@ -126,7 +126,6 @@ public class DateProcessorTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testJavaPatternLocale() {
|
||||
// @AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/31724")
|
||||
assumeFalse("Can't run in a FIPS JVM, Joda parse date error", inFipsJvm());
|
||||
DateProcessor dateProcessor = new DateProcessor(randomAlphaOfLength(10),
|
||||
templatize(ZoneId.of("Europe/Amsterdam")), templatize(Locale.ITALIAN),
|
||||
|
@ -138,6 +137,18 @@ public class DateProcessorTests extends ESTestCase {
|
|||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("2010-06-12T00:00:00.000+02:00"));
|
||||
}
|
||||
|
||||
public void testJavaPatternEnglishLocale() {
|
||||
// Since testJavaPatternLocale is muted in FIPS mode, test that we can correctly parse dates in english
|
||||
DateProcessor dateProcessor = new DateProcessor(randomAlphaOfLength(10),
|
||||
templatize(ZoneId.of("Europe/Amsterdam")), templatize(Locale.ENGLISH),
|
||||
"date_as_string", Collections.singletonList("yyyy dd MMMM"), "date_as_date");
|
||||
Map<String, Object> document = new HashMap<>();
|
||||
document.put("date_as_string", "2010 12 June");
|
||||
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
|
||||
dateProcessor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("2010-06-12T00:00:00.000+02:00"));
|
||||
}
|
||||
|
||||
public void testJavaPatternDefaultYear() {
|
||||
String format = randomFrom("dd/MM", "8dd/MM");
|
||||
DateProcessor dateProcessor = new DateProcessor(randomAlphaOfLength(10),
|
||||
|
|
Loading…
Reference in New Issue