Skip to content

Conversation

@parkertimmins
Copy link
Contributor

The patterned_text random testing code picks dates with year less 10000, as the date formatter cannot handle years with 5 digits. Since a random time zone is used, if a date is within 1 day of year 10k, the formatted date in the selected timezone may be year 10k. If this occurs, just pick a different date.

Fixes #133598

@parkertimmins parkertimmins added >test Issues or PRs that are addressing/adding tests :StorageEngine/Mapping The storage related side of mappings labels Aug 27, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @parkertimmins

private static String randomTimestamp() {
long millis = randomMillisUpToYear9999();
ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), randomZone());
ZonedDateTime zonedDateTime;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe use randomValueOtherThanMany?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dnhatn! Oh nice, randomValueOtherThanMany makes it much cleaner

@parkertimmins parkertimmins merged commit 6d0711a into elastic:main Aug 27, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:StorageEngine/Mapping The storage related side of mappings Team:StorageEngine >test Issues or PRs that are addressing/adding tests v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] PatternedTextFieldMapperTests testSyntheticSourceMany failing

3 participants