Skip to content

Conversation

nielsbauman
Copy link
Contributor

As a follow-up of #133954, this class could use a clean up in deduplicating code, replacing some assertBusys with awaitIndexExists, and more.

As a follow-up of elastic#133954, this class could use a clean up in
deduplicating code, replacing some `assertBusy`s with
`awaitIndexExists`, and more.
@nielsbauman nielsbauman requested a review from Copilot September 8, 2025 15:38
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.2.0 labels Sep 8, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the SearchableSnapshotActionIT test class to reduce code duplication, improve maintainability, and replace repetitive assertBusy calls with more specific helper methods.

  • Replaces manual index existence checks and assertBusy with awaitIndexExists and awaitIndexDoesNotExist
  • Consolidates duplicate snapshot retrieval logic into a reusable getSnapshots() method
  • Replaces custom step key checking with TimeSeriesRestDriver.awaitStepKey()

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
SearchableSnapshotActionIT.java Removes duplicate code patterns, replaces assertBusy with helper methods, removes unused imports and suppressions
TimeSeriesRestDriver.java Adds awaitStepKey method and makes getStepKey public to support refactoring

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nielsbauman nielsbauman added >test Issues or PRs that are addressing/adding tests :Data Management/ILM+SLM Index and Snapshot lifecycle management and removed needs:triage Requires assignment of a team area label labels Sep 8, 2025
@nielsbauman nielsbauman requested a review from dakrone September 8, 2025 15:39
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Sep 8, 2025
Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, though I notice we're changing a lot of timeouts to be shorter. Do you have any concerns with that, or do we think things have sped up to where they shouldn't cause failures?

Comment on lines -257 to +246
assertBusy(() -> assertFalse(indexExists(backingIndexName)), 60, TimeUnit.SECONDS);
assertBusy(() -> assertFalse(indexExists(restoredIndexName)), 60, TimeUnit.SECONDS);
awaitIndexDoesNotExist(backingIndexName);
awaitIndexDoesNotExist(restoredIndexName);
Copy link
Member

Choose a reason for hiding this comment

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

We're switching these here from a 60 second timeout to a 10 second timeout, do you have any concerns about this failing in some cases?

Copy link
Contributor Author

@nielsbauman nielsbauman Sep 8, 2025

Choose a reason for hiding this comment

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

From what I could tell by looking at the history of this class, most timeouts looked like they were simply copied over from other places. And these 60-second timeouts are simply excessive; there is no way ILM needs a whole minute to get to that stage. I decided to clear out all custom timeouts to have a clean slate. I've been running this class on repeat for more than a day on 3 VMs. While that doesn't prove that no failures will occur on our CI VMs, I feel confident to merge this PR as-is. If failures do come up, I will take it upon myself to have a look at them. Although I'd probably first look at changing the setup/order of the test before resorting to simply increasing timeouts.

@nielsbauman nielsbauman enabled auto-merge (squash) September 8, 2025 17:16
@nielsbauman nielsbauman merged commit 222cae0 into elastic:main Sep 8, 2025
33 checks passed
@nielsbauman nielsbauman deleted the searchable-snapshot-test-cleanup branch September 8, 2025 18:14
rjernst pushed a commit to rjernst/elasticsearch that referenced this pull request Sep 9, 2025
As a follow-up of elastic#133954, this class could use a clean up in
deduplicating code, replacing some `assertBusy`s with
`awaitIndexExists`, and more.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/ILM+SLM Index and Snapshot lifecycle management Team:Data Management Meta label for data/management team >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.

3 participants