Skip to content

Commit a97e006

Browse files
authored
Fix data stream retrieval in DataStreamLifecycleServiceRuntimeSecurityIT (#125667)
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 c521264 commit a97e006

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
@@ -302,9 +302,6 @@ tests:
302302
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
303303
method: testStopQueryLocal
304304
issue: https://github.com/elastic/elasticsearch/issues/121672
305-
- class: org.elasticsearch.integration.DataStreamLifecycleServiceRuntimeSecurityIT
306-
method: testRolloverLifecycleAndForceMergeAuthorized
307-
issue: https://github.com/elastic/elasticsearch/issues/124978
308305
- class: org.elasticsearch.packaging.test.BootstrapCheckTests
309306
method: test10Install
310307
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)