-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
make DateMathIndexExpressionsIntegrationIT more resilient #38473
Conversation
Pinging @elastic/es-core-infra |
Pinging @elastic/es-core-features |
happy to collect any feedback anyone has, I tried recreating the issue |
the internal cluster calls System.nanoTime() and System.currentTimeMillis() during evaluations of requests that need date-math index resolution. These are not mockable in these tests. As is, executing requests as-is in these test cases can potentially result in invalid responses when day-boundaries are hit mid test run. This change makes the test framework ignore failures due to day changes. Closes elastic#31067.
run elasticsearch-ci/1 |
in some places (watcher plugin integration tests |
that is a tough one. |
I guess this is no rush, so maybe the refactoring route is a better one |
@talevy just cross-linking this issue that I just opened about some time-related test failures in watcher tests (HistoryIntegrationTests) just in case you want to add some thoughts about "controlling time" in these kind of situations. Maybe it doesn't apply but might be worth adding a few ideas if you thought about something in the context of this PR. |
response = builder.get(); | ||
} catch (IndexNotFoundException e) { | ||
// index resolver throws this if it does not find the exact index due to day changes | ||
dayChangeAssumption.run(); |
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.
Removed previous comment. I see it is working. Getdayofyear will change..
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 reason this is here is because the System.nanotime's day that is picked up in a search request's start-time can differ from the indices that were created, which will cause indices to be resolved to ones that do not exist. This means that the dayChange occurred between the time of the first dayChangeAssumption.run(), and the time the search had begun. Although this time window is super small, could still happen and happened to me once during testing.
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.
when this occurs, I set a dayChangeAssumption check to run before throwing the exception so that if the error is because of the day change, I want the test to be ignored. If there was an IndexNotFoundException thrown and the day didn't change, then there is a real problem and the exception should be re-thrown.
does that make sense?
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.
Yes, thank you for making it clear. I think this is a good change and we should have this merged before we make an attempt to refactor this in a more general way
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.
given our build is getting flakey it is definitely worthy to have this merged
thank you for looking into this!
LGTM
@elasticmachine run elasticsearch-ci/1 |
thanks @pgomulka! |
* master: (1159 commits) Fix timezone fallback in ingest processor (elastic#38407) Avoid polluting download stats on builds (elastic#38660) SQL: Prevent grouping over grouping functions (elastic#38649) SQL: Relax StackOverflow circuit breaker for constants (elastic#38572) [DOCS] Fixes broken migration links (elastic#38655) Drop support for the low-level REST client on JDK 7 (elastic#38540) [DOCS] Adds placeholders for v8 highlights, breaking changes, release notes (elastic#38641) fix dissect doc "ip" --> "clientip" (elastic#38545) Concurrent file chunk fetching for CCR restore (elastic#38495) make DateMathIndexExpressionsIntegrationIT more resilient (elastic#38473) SQL: Replace joda with java time (elastic#38437) Add fuzziness example (elastic#37194) (elastic#38648) 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) ...
* master: Fix timezone fallback in ingest processor (elastic#38407) Avoid polluting download stats on builds (elastic#38660) SQL: Prevent grouping over grouping functions (elastic#38649) SQL: Relax StackOverflow circuit breaker for constants (elastic#38572) [DOCS] Fixes broken migration links (elastic#38655) Drop support for the low-level REST client on JDK 7 (elastic#38540) [DOCS] Adds placeholders for v8 highlights, breaking changes, release notes (elastic#38641) fix dissect doc "ip" --> "clientip" (elastic#38545) Concurrent file chunk fetching for CCR restore (elastic#38495) make DateMathIndexExpressionsIntegrationIT more resilient (elastic#38473) SQL: Replace joda with java time (elastic#38437) Add fuzziness example (elastic#37194) (elastic#38648)
the internal cluster calls System.nanoTime() and System.currentTimeMillis() during
evaluations of requests that need date-math index resolution. These are not mockable
in these tests. As is, executing requests as-is in these test cases can potentially result
in invalid responses when day-boundaries are hit mid test run.
This change makes the test framework ignore failures due to day changes.
Closes #31067.