Skip to content

Conversation

@gmarouli
Copy link
Contributor

The tests in DataStreamIT were using DataStream::getDefaultBackingIndexName to determine the name of the backing index of a data stream. Since DataStream::getDefaultBackingIndexName is time sensitive (it uses the day in the index name), if the tests are executed around midnight there is a chance that the tests will fail.

To fix that, we took the following steps:

  • Retrieve the backing index name directly using the APIs either via getting the data stream or rolling over.
  • Use the matcher backingIndexEqualTo to verify if the name of the index is the expected one by checking the data stream name and the generation but not the day.

Closes: #90595

@gmarouli gmarouli added >test Issues or PRs that are addressing/adding tests :Data Management/Data streams Data streams and their lifecycles auto-backport Automatically create backport pull requests when merged v8.5.1 v8.6.0 labels Oct 14, 2022
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Oct 14, 2022
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@andreidan andreidan 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 for fixing these Mary

assertThat(dataStream.getIndices().get(0).getName(), backingIndexEqualTo("metrics-foo", 1));

String backingIndex = DataStream.getDefaultBackingIndexName("metrics-bar", 1);
DataStream barDataStream = getDataStreamResponse.getDataStreams().get(0).getDataStream();
Copy link
Contributor

Choose a reason for hiding this comment

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

bar is before foo ! 🤯 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha, you are laughing but when I was first reading it I could swear foo was before bar :p. I had to reread it.

@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.5

@csoulios csoulios added v8.5.0 and removed v8.5.1 labels Nov 8, 2022
@gmarouli gmarouli deleted the test-fix-90595-DataStreamIT branch August 20, 2024 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged :Data Management/Data streams Data streams and their lifecycles Team:Data Management Meta label for data/management team >test Issues or PRs that are addressing/adding tests v8.5.0 v8.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] DataStreamIT testBasicScenario failing

4 participants