Skip to content

Remove test usages of DataStream#getDefaultBackingIndexName #123376

Closed
@nielsbauman

Description

@nielsbauman

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.

Metadata

Metadata

Assignees

Labels

:Data Management/Data streamsData streams and their lifecycles>testIssues or PRs that are addressing/adding testsTeam:Data ManagementMeta label for data/management team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions