Description
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
-
elasticsearch.modules.data-streams.internalClusterTest
(19 usages found) Remove test usages ofgetDefaultBackingIndexName
in DS and LogsDB tests #127384 -
elasticsearch.x-pack.plugin.ilm.internalClusterTest
(2 usages found) Remove test usages ofDataStream#getDefaultBackingIndexName
in ILM integration tests #124319 -
elasticsearch.x-pack.plugin.ilm.qa.multi-node.javaRestTest
(10 usages found) Remove test usages ofDataStream#getDefaultBackingIndexName
in ILM integration tests #124319 -
elasticsearch.x-pack.plugin.logsdb.javaRestTest
(3 usages found) Remove test usages ofgetDefaultBackingIndexName
in DS and LogsDB tests #127384 -
elasticsearch.x-pack.plugin.logsdb.qa.with-basic.javaRestTest
Remove test usages ofgetDefaultBackingIndexName
in DS and LogsDB tests #127384 -
elasticsearch.x-pack.plugin.ccr.javaRestTest
(3 usages found) Remove test usages ofgetDefaultBackingIndexName
in CCR tests #127693
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.