|
62 | 62 | import static org.elasticsearch.xpack.TimeSeriesRestDriver.rolloverMaxOneDocCondition; |
63 | 63 | import static org.elasticsearch.xpack.core.ilm.DeleteAction.WITH_SNAPSHOT_DELETE; |
64 | 64 | import static org.hamcrest.Matchers.containsString; |
65 | | -import static org.hamcrest.Matchers.endsWith; |
66 | 65 | import static org.hamcrest.Matchers.equalTo; |
67 | 66 | import static org.hamcrest.Matchers.greaterThanOrEqualTo; |
68 | 67 | import static org.hamcrest.Matchers.is; |
@@ -103,8 +102,9 @@ public void testSearchableSnapshotAction() throws Exception { |
103 | 102 | // rolling over the data stream so we can apply the searchable snapshot policy to a backing index that's not the write index |
104 | 103 | rolloverMaxOneDocCondition(client(), dataStream); |
105 | 104 |
|
106 | | - String backingIndexName = getDataStreamBackingIndexNames(dataStream).getFirst(); |
107 | | - assertThat(backingIndexName, endsWith("1")); |
| 105 | + List<String> backingIndices = getDataStreamBackingIndexNames(dataStream); |
| 106 | + assertThat(backingIndices.size(), equalTo(2)); |
| 107 | + String backingIndexName = backingIndices.getFirst(); |
108 | 108 | String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName; |
109 | 109 | assertTrue(waitUntil(() -> { |
110 | 110 | try { |
@@ -135,8 +135,8 @@ public void testSearchableSnapshotForceMergesIndexToOneSegment() throws Exceptio |
135 | 135 | indexDocument(client(), dataStream, true); |
136 | 136 | } |
137 | 137 |
|
138 | | - String backingIndexName = getDataStreamBackingIndexNames(dataStream).getFirst(); |
139 | | - assertThat(backingIndexName, endsWith("1")); |
| 138 | + List<String> backingIndices = getDataStreamBackingIndexNames(dataStream); |
| 139 | + String backingIndexName = backingIndices.getFirst(); |
140 | 140 | Integer preLifecycleBackingIndexSegments = getNumberOfPrimarySegments(client(), backingIndexName); |
141 | 141 | assertThat(preLifecycleBackingIndexSegments, greaterThanOrEqualTo(1)); |
142 | 142 |
|
@@ -210,8 +210,9 @@ public void testDeleteActionDeletesSearchableSnapshot() throws Exception { |
210 | 210 | // rolling over the data stream so we can apply the searchable snapshot policy to a backing index that's not the write index |
211 | 211 | rolloverMaxOneDocCondition(client(), dataStream); |
212 | 212 |
|
213 | | - String backingIndexName = getDataStreamBackingIndexNames(dataStream).getFirst(); |
214 | | - assertThat(backingIndexName, endsWith("1")); |
| 213 | + List<String> backingIndices = getDataStreamBackingIndexNames(dataStream); |
| 214 | + assertThat(backingIndices.size(), equalTo(2)); |
| 215 | + String backingIndexName = backingIndices.getFirst(); |
215 | 216 | String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName; |
216 | 217 |
|
217 | 218 | // let's wait for ILM to finish |
@@ -923,8 +924,9 @@ public void testSearchableSnapshotInvokesAsyncActionOnNewIndex() throws Exceptio |
923 | 924 | // rolling over the data stream so we can apply the searchable snapshot policy to a backing index that's not the write index |
924 | 925 | rolloverMaxOneDocCondition(client(), dataStream); |
925 | 926 |
|
926 | | - String backingIndexName = getDataStreamBackingIndexNames(dataStream).getFirst(); |
927 | | - assertThat(backingIndexName, endsWith("1")); |
| 927 | + List<String> backingIndices = getDataStreamBackingIndexNames(dataStream); |
| 928 | + assertThat(backingIndices.size(), equalTo(2)); |
| 929 | + String backingIndexName = backingIndices.getFirst(); |
928 | 930 | String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName; |
929 | 931 | assertTrue(waitUntil(() -> { |
930 | 932 | try { |
@@ -1028,8 +1030,9 @@ public void testSearchableSnapshotReplicateFor() throws Exception { |
1028 | 1030 | // rolling over the data stream so we can apply the searchable snapshot policy to a backing index that's not the write index |
1029 | 1031 | rolloverMaxOneDocCondition(client(), dataStream); |
1030 | 1032 |
|
1031 | | - String backingIndexName = getDataStreamBackingIndexNames(dataStream).getFirst(); |
1032 | | - assertThat(backingIndexName, endsWith("1")); |
| 1033 | + List<String> backingIndices = getDataStreamBackingIndexNames(dataStream); |
| 1034 | + assertThat(backingIndices.size(), equalTo(2)); |
| 1035 | + String backingIndexName = backingIndices.getFirst(); |
1033 | 1036 | String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName; |
1034 | 1037 | assertTrue(waitUntil(() -> { |
1035 | 1038 | try { |
|
0 commit comments