Skip to content

Remove test usages of DataStream#getDefaultBackingIndexName #123376

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

Open
6 of 14 tasks
nielsbauman opened this issue Feb 25, 2025 · 1 comment
Open
6 of 14 tasks

Remove test usages of DataStream#getDefaultBackingIndexName #123376

nielsbauman opened this issue Feb 25, 2025 · 1 comment
Labels
: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

Comments

@nielsbauman
Copy link
Contributor

nielsbauman commented Feb 25, 2025

We've already seen several test failures that were caused by (integration) test usages of DataStream#getDefaultBackingIndexName. The danger is that when a test runs around midnight, the test cluster might create a data stream backing index using day X and the test that calls getDefaultBackingIndexName uses day X + 1 because it executed a few milliseconds later. That causes the test to look for a backing index that will never exist.

The solution is straightforward: retrieve the list of backing indices from the data stream and extract the backing index name from that list.

Integration tests

Unit tests
Unit tests do not fail that often because they are much faster, but it would be good to check that this method is not used multiple times in a unit test or it is replaced by the getDefaultBackingIndexName that uses the provided timestamp

  • elasticsearch.modules.data-streams.test (50 usages found)
  • elasticsearch.server.test (106 usages found)
  • elasticsearch.x-pack.plugin.ccr.qa.multi-cluster.test (3 usages found)
  • elasticsearch.x-pack.plugin.ccr.test (19 usages found)
  • elasticsearch.x-pack.plugin.core.test (3 usages found)
  • elasticsearch.x-pack.plugin.logsdb.test (18 usages found)
  • elasticsearch.x-pack.plugin.ml.test (1 usage found)
  • elasticsearch.x-pack.plugin.security.test (8 usages found)

Not all the usages above are incorrect. But this can be used to track the progress.

@nielsbauman nielsbauman added :Data Management/Data streams Data streams and their lifecycles >test Issues or PRs that are addressing/adding tests Team:Data Management Meta label for data/management team labels Feb 25, 2025
@elasticsearchmachine
Copy link
Collaborator

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

nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue Feb 25, 2025
When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes elastic#123086
Relates elastic#123376
nielsbauman added a commit that referenced this issue Feb 26, 2025
When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes #123086
Relates #123376
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue Feb 26, 2025
When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes elastic#123086
Relates elastic#123376
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue Feb 26, 2025
When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes elastic#123086
Relates elastic#123376

(cherry picked from commit f0f0eeb)

# Conflicts:
#	x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue Feb 26, 2025
When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes elastic#123086
Relates elastic#123376

(cherry picked from commit f0f0eeb)

# Conflicts:
#	x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue Feb 26, 2025
When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes elastic#123086
Relates elastic#123376

(cherry picked from commit f0f0eeb)

# Conflicts:
#	x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue Feb 26, 2025
When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes elastic#123086
Relates elastic#123376

(cherry picked from commit f0f0eeb)

# Conflicts:
#	x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java
elasticsearchmachine pushed a commit that referenced this issue Feb 26, 2025
When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes #123086
Relates #123376
nielsbauman added a commit that referenced this issue Feb 26, 2025
…3472)

When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes #123086
Relates #123376
elasticsearchmachine pushed a commit that referenced this issue Feb 26, 2025
…23475)

* Fix failing test(s) in `TimeSeriesDataStreamsIT` (#123378)

When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes #123086
Relates #123376

(cherry picked from commit f0f0eeb)

# Conflicts:
#	x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java

* Fix compilation
elasticsearchmachine pushed a commit that referenced this issue Feb 26, 2025
…23473)

* Fix failing test(s) in `TimeSeriesDataStreamsIT` (#123378)

When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes #123086
Relates #123376

(cherry picked from commit f0f0eeb)

# Conflicts:
#	x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java

* Fix compilation
nielsbauman added a commit that referenced this issue Feb 27, 2025
…23474)

When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes #123086
Relates #123376
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue Apr 25, 2025
…ests

We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates elastic#123376
nielsbauman added a commit that referenced this issue Apr 29, 2025
…ests (#127384)

We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates #123376
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue Apr 29, 2025
…ests (elastic#127384)

We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates elastic#123376
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue Apr 30, 2025
…ests (elastic#127384)

We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates elastic#123376
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue Apr 30, 2025
…ests (elastic#127384)

We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates elastic#123376
elasticsearchmachine pushed a commit that referenced this issue Apr 30, 2025
…ests (#127384) (#127503)

We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates #123376
elasticsearchmachine pushed a commit that referenced this issue Apr 30, 2025
…ests (#127384) (#127502)

We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates #123376
nielsbauman added a commit that referenced this issue May 3, 2025
We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates #123376
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue May 5, 2025
We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates elastic#123376
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue May 5, 2025
We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates elastic#123376
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this issue May 5, 2025
We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates elastic#123376
nielsbauman added a commit that referenced this issue May 6, 2025
)

We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates #123376
parkertimmins pushed a commit to parkertimmins/elasticsearch that referenced this issue May 7, 2025
…tic#127693)

We replace usages of time sensitive
`DataStream#getDefaultBackingIndexName` with the retrieval of the name
via an API call. The problem with using the time sensitive method is
that we can have test failures around midnight.

Relates elastic#123376
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
: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
Projects
None yet
Development

No branches or pull requests

2 participants