-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix HistoryIntegrationTests timestamp comparsion #38505
Fix HistoryIntegrationTests timestamp comparsion #38505
Conversation
Pinging @elastic/es-core-infra |
This was spotted in a PR Build https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+pull-request-2/7451/console
However the
|
When the millisecond part of a timestamp is 0 the toString representation in java-time is ommiting the millisecond part (joda was not). The Search response is returning timestamps formatted with WatcherDateTimeUtils, therefore comparisons of strings should be done with the same formatter
c431150
to
bdd9887
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me. However I'm wondering if we could change the test to be reproducable just using the random seed. Its not ideal that this test currently only fails when overwriting the ClockMock constructor. Maybe there is a way to initialize the clock used in tests with a date that depends on the random seed only and then freeze it? I don't know if this is possible in this test but I think it would be a great improvement. Could be done in a follow up PR though.
@pgomulka just to follow up on my last comment, the ClockMock seems to be initalized by the TimeWarpedWatcher plugin used in watcher tests. |
@cbuescher yes ideally it would be great to make the time depending on the seed we provide, for instance
but then we would need to be sure that all the usages of ZonedDateTime.now are using a this clock, otherwise the clock would be in 1970's and other parts of code in 2019 |
I think this would end up a much bigger change, better to tackle that in a separate PR. We are having similar discussion on this PR: #38473 |
Agreed, I'm also not sure if it would be feasible in the case of HistoryIntegrationTests. I'll open an issue about it to track it though. |
@pgomulka can you add a version label and some sort of scope (I think its the ">test-failure" or sth. similar) to this so this gets sorted right for the release changes? |
I opened #38520 to track the question of missing reproducability here. |
* master: ML: update set_upgrade_mode, add logging (elastic#38372) bad formatted JSON object (elastic#38515) (elastic#38525) Fix HistoryIntegrationTests timestamp comparsion (elastic#38505) SQL: Fix issue with IN not resolving to underlying keyword field (elastic#38440) Fix the clock resolution to millis in ScheduledEventTests (elastic#38506)
When the millisecond part of a timestamp is 0 the toString representation in java-time is omitting the millisecond part (joda was not). The Search response is returning timestamps formatted with WatcherDateTimeUtils, therefore comparisons of strings should be done with the same formatter relates elastic#27330
When the millisecond part of a timestamp is 0 the toString representation in java-time is omitting the millisecond part (joda was not). The Search response is returning timestamps formatted with WatcherDateTimeUtils, therefore comparisons of strings should be done with the same formatter relates elastic#27330
…8505) When the millisecond part of a timestamp is 0 the toString representation in java-time is omitting the millisecond part (joda was not). The Search response is returning timestamps formatted with WatcherDateTimeUtils, therefore comparisons of strings should be done with the same formatter relates #27330 backport#38505
* 7.0: Mute IndexFollowingIT.testIndexFallBehind (elastic#38618) Mute failing WatchStatusIntegrationTests (elastic#38621) Mute failing ApiKeyIntegTests (elastic#38614) Fix the clock resolution to millis in ScheduledEventTests (elastic#38517) [DOCS] Add warning about bypassing ML PUT APIs (elastic#38606) Fix HistoryIntegrationTests timestamp comparsion (elastic#38566) Backport(elastic#38505) Mute RetentionLeastIT.testRetentionLeasesSyncOnRecovery on 7x (elastic#38600) Fix version logic when bumping major version (elastic#38595)
When the millisecond part of a timestamp is 0 the toString representation in java-time is omitting the millisecond part (joda was not). The Search response is returning timestamps formatted with WatcherDateTimeUtils, therefore comparisons of strings should be done with the same formatter relates #27330 BackPort #38505
* master: (27 commits) Mute AnalysisModuleTests#testStandardFilterBWC (elastic#38636) add geotile_grid ref to asciidoc (elastic#38632) Enable Dockerfile from artifacts.elastic.co (elastic#38552) Mute FollowerFailOverIT testFailOverOnFollower (elastic#38634) Account for a possible rolled over file while reading the audit log file (elastic#34909) Mute failure in InternalEngineTests (elastic#38622) Fix Issue with Concurrent Snapshot Init + Delete (elastic#38518) Refactor ZonedDateTime.now in millis resolution (elastic#38577) Mute failing WatchStatusIntegrationTests (elastic#38621) Mute failing ApiKeyIntegTests (elastic#38614) [DOCS] Add warning about bypassing ML PUT APIs (elastic#38509) Add 7.1 and 8.0 version constants to master (elastic#38514) ML: update set_upgrade_mode, add logging (elastic#38372) bad formatted JSON object (elastic#38515) (elastic#38525) Fix HistoryIntegrationTests timestamp comparsion (elastic#38505) SQL: Fix issue with IN not resolving to underlying keyword field (elastic#38440) Fix the clock resolution to millis in ScheduledEventTests (elastic#38506) Enable BWC after backport recovering leases (elastic#38485) Collapse retention lease integration tests (elastic#38483) TransportVerifyShardBeforeCloseAction should force a flush (elastic#38401) ...
When the millisecond part of a timestamp is 0 the toString
representation in java-time is omitting the millisecond part (joda was
not). The Search response is returning timestamps formatted with
WatcherDateTimeUtils, therefore comparisons of strings should be done
with the same formatter
relates #27330