Skip to content

Commit 60fc5f1

Browse files
committed
Fix data stream retrieval in DataStreamLifecycleServiceRuntimeSecurityIT
This test seemed to fail because we would index another document before the master processed the data stream rollover - which is possible because non-master nodes expose the next cluster state a little bit earlier than the master node. Caused by #122852 Fixes #124978
1 parent ebc1353 commit 60fc5f1

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,6 @@ tests:
339339
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
340340
method: testStopQuery
341341
issue: https://github.com/elastic/elasticsearch/issues/124977
342-
- class: org.elasticsearch.integration.DataStreamLifecycleServiceRuntimeSecurityIT
343-
method: testRolloverLifecycleAndForceMergeAuthorized
344-
issue: https://github.com/elastic/elasticsearch/issues/124978
345342
- class: org.elasticsearch.packaging.test.BootstrapCheckTests
346343
method: test10Install
347344
issue: https://github.com/elastic/elasticsearch/issues/124957

x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/integration/DataStreamLifecycleServiceRuntimeSecurityIT.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,19 @@ public void testRolloverLifecycleAndForceMergeAuthorized() throws Exception {
9797
// empty lifecycle contains the default rollover
9898
prepareDataStreamAndIndex(dataStreamName, DataStreamLifecycle.Template.DEFAULT);
9999

100-
assertBusy(() -> {
101-
assertNoAuthzErrors();
102-
List<Index> backingIndices = getDataStreamBackingIndices(dataStreamName);
103-
assertThat(backingIndices.size(), equalTo(2));
104-
String backingIndex = backingIndices.get(0).getName();
105-
assertThat(backingIndex, backingIndexEqualTo(dataStreamName, 1));
106-
String writeIndex = backingIndices.get(1).getName();
107-
assertThat(writeIndex, backingIndexEqualTo(dataStreamName, 2));
108-
});
100+
List<String> backingIndices = waitForDataStreamBackingIndices(dataStreamName, 2);
101+
String backingIndex = backingIndices.get(0);
102+
assertThat(backingIndex, backingIndexEqualTo(dataStreamName, 1));
103+
String writeIndex = backingIndices.get(1);
104+
assertThat(writeIndex, backingIndexEqualTo(dataStreamName, 2));
105+
106+
assertNoAuthzErrors();
109107
// Index another doc to force another rollover and trigger an attempted force-merge. The force-merge may be a noop under
110108
// the hood but for authz purposes this doesn't matter, it only matters that the force-merge API was called
111109
indexDoc(dataStreamName);
112-
assertBusy(() -> {
113-
assertNoAuthzErrors();
114-
List<Index> backingIndices = getDataStreamBackingIndices(dataStreamName);
115-
assertThat(backingIndices.size(), equalTo(3));
116-
});
110+
111+
waitForDataStreamBackingIndices(dataStreamName, 3);
112+
assertNoAuthzErrors();
117113
}
118114

119115
public void testRolloverAndRetentionAuthorized() throws Exception {

0 commit comments

Comments
 (0)