Skip to content

Commit 178a706

Browse files
committed
Incorporate review comments
1 parent 027c281 commit 178a706

File tree

6 files changed

+21
-20
lines changed

6 files changed

+21
-20
lines changed

test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ public List<String> getDataStreamBackingIndexNames(String dataStreamName) {
860860
GetDataStreamAction.Response response = safeGet(
861861
client().execute(
862862
GetDataStreamAction.INSTANCE,
863-
new GetDataStreamAction.Request(TimeValue.THIRTY_SECONDS, new String[] { dataStreamName })
863+
new GetDataStreamAction.Request(TEST_REQUEST_TIMEOUT, new String[] { dataStreamName })
864864
)
865865
);
866866
assertThat(response.getDataStreams().size(), equalTo(1));

x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/LifecycleLicenseIT.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.junit.Before;
3030

3131
import java.io.IOException;
32+
import java.util.List;
3233
import java.util.Locale;
3334
import java.util.Map;
3435
import java.util.concurrent.TimeUnit;
@@ -40,7 +41,7 @@
4041
import static org.elasticsearch.xpack.TimeSeriesRestDriver.indexDocument;
4142
import static org.elasticsearch.xpack.TimeSeriesRestDriver.rolloverMaxOneDocCondition;
4243
import static org.hamcrest.CoreMatchers.containsStringIgnoringCase;
43-
import static org.hamcrest.Matchers.endsWith;
44+
import static org.hamcrest.Matchers.equalTo;
4445
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
4546
import static org.hamcrest.Matchers.is;
4647

@@ -107,8 +108,9 @@ public void testSearchableSnapshotActionErrorsOnInvalidLicense() throws Exceptio
107108
// rolling over the data stream so we can apply the searchable snapshot policy to a backing index that's not the write index
108109
rolloverMaxOneDocCondition(client(), dataStream);
109110

110-
String backingIndexName = getDataStreamBackingIndexNames(dataStream).getFirst();
111-
assertThat(backingIndexName, endsWith("1"));
111+
List<String> backingIndices = getDataStreamBackingIndexNames(dataStream);
112+
assertThat(backingIndices.size(), equalTo(2));
113+
String backingIndexName = backingIndices.getFirst();
112114
// the searchable_snapshot action should start failing (and retrying) due to invalid license
113115
assertBusy(() -> {
114116
Map<String, Object> explainIndex = explainIndex(client(), backingIndexName);

x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,8 +1229,8 @@ private void assertHistoryIsPresent(
12291229
fail("failed to perform search:" + e.getMessage());
12301230
}
12311231

1232+
// Finally, check that the history index is in a good state
12321233
String historyIndexName = getDataStreamBackingIndexNames("ilm-history-7").getFirst();
1233-
assertThat(historyIndexName, notNullValue());
12341234
Response explainHistoryIndex = client().performRequest(new Request("GET", historyIndexName + "/_lifecycle/explain"));
12351235
Map<String, Object> responseMap;
12361236
try (InputStream is = explainHistoryIndex.getEntity().getContent()) {

x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/actions/SearchableSnapshotActionIT.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
import static org.elasticsearch.xpack.TimeSeriesRestDriver.rolloverMaxOneDocCondition;
6363
import static org.elasticsearch.xpack.core.ilm.DeleteAction.WITH_SNAPSHOT_DELETE;
6464
import static org.hamcrest.Matchers.containsString;
65-
import static org.hamcrest.Matchers.endsWith;
6665
import static org.hamcrest.Matchers.equalTo;
6766
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
6867
import static org.hamcrest.Matchers.is;
@@ -103,8 +102,9 @@ public void testSearchableSnapshotAction() throws Exception {
103102
// rolling over the data stream so we can apply the searchable snapshot policy to a backing index that's not the write index
104103
rolloverMaxOneDocCondition(client(), dataStream);
105104

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();
108108
String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName;
109109
assertTrue(waitUntil(() -> {
110110
try {
@@ -135,8 +135,8 @@ public void testSearchableSnapshotForceMergesIndexToOneSegment() throws Exceptio
135135
indexDocument(client(), dataStream, true);
136136
}
137137

138-
String backingIndexName = getDataStreamBackingIndexNames(dataStream).getFirst();
139-
assertThat(backingIndexName, endsWith("1"));
138+
List<String> backingIndices = getDataStreamBackingIndexNames(dataStream);
139+
String backingIndexName = backingIndices.getFirst();
140140
Integer preLifecycleBackingIndexSegments = getNumberOfPrimarySegments(client(), backingIndexName);
141141
assertThat(preLifecycleBackingIndexSegments, greaterThanOrEqualTo(1));
142142

@@ -210,8 +210,9 @@ public void testDeleteActionDeletesSearchableSnapshot() throws Exception {
210210
// rolling over the data stream so we can apply the searchable snapshot policy to a backing index that's not the write index
211211
rolloverMaxOneDocCondition(client(), dataStream);
212212

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();
215216
String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName;
216217

217218
// let's wait for ILM to finish
@@ -923,8 +924,9 @@ public void testSearchableSnapshotInvokesAsyncActionOnNewIndex() throws Exceptio
923924
// rolling over the data stream so we can apply the searchable snapshot policy to a backing index that's not the write index
924925
rolloverMaxOneDocCondition(client(), dataStream);
925926

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();
928930
String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName;
929931
assertTrue(waitUntil(() -> {
930932
try {
@@ -1028,8 +1030,9 @@ public void testSearchableSnapshotReplicateFor() throws Exception {
10281030
// rolling over the data stream so we can apply the searchable snapshot policy to a backing index that's not the write index
10291031
rolloverMaxOneDocCondition(client(), dataStream);
10301032

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();
10331036
String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName;
10341037
assertTrue(waitUntil(() -> {
10351038
try {

x-pack/plugin/ilm/src/internalClusterTest/java/org/elasticsearch/xpack/ilm/ILMMultiNodeIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
import static org.elasticsearch.xpack.core.ilm.ShrinkIndexNameSupplier.SHRUNKEN_INDEX_PREFIX;
4242
import static org.hamcrest.Matchers.equalTo;
43-
import static org.hamcrest.Matchers.notNullValue;
4443

4544
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, numClientNodes = 0)
4645
public class ILMMultiNodeIT extends ESIntegTestCase {
@@ -106,7 +105,6 @@ public void testShrinkOnTiers() throws Exception {
106105
logger.info("--> explain: {}", Strings.toString(explain));
107106

108107
String backingIndexName = getDataStreamBackingIndexNames(index).getFirst();
109-
assertThat(backingIndexName, notNullValue());
110108
IndexLifecycleExplainResponse indexResp = null;
111109
for (Map.Entry<String, IndexLifecycleExplainResponse> indexNameAndResp : explain.getIndexResponses().entrySet()) {
112110
if (indexNameAndResp.getKey().startsWith(SHRUNKEN_INDEX_PREFIX) && indexNameAndResp.getKey().contains(backingIndexName)) {

x-pack/plugin/ilm/src/internalClusterTest/java/org/elasticsearch/xpack/ilm/ILMMultiNodeWithCCRDisabledIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
import static org.elasticsearch.xpack.core.ilm.ShrinkIndexNameSupplier.SHRUNKEN_INDEX_PREFIX;
4343
import static org.hamcrest.Matchers.equalTo;
44-
import static org.hamcrest.Matchers.notNullValue;
4544

4645
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, numClientNodes = 0)
4746
public class ILMMultiNodeWithCCRDisabledIT extends ESIntegTestCase {
@@ -106,7 +105,6 @@ public void testShrinkOnTiers() throws Exception {
106105
logger.info("--> explain: {}", Strings.toString(explain));
107106

108107
String backingIndexName = getDataStreamBackingIndexNames(index).getFirst();
109-
assertThat(backingIndexName, notNullValue());
110108
IndexLifecycleExplainResponse indexResp = null;
111109
for (Map.Entry<String, IndexLifecycleExplainResponse> indexNameAndResp : explain.getIndexResponses().entrySet()) {
112110
if (indexNameAndResp.getKey().startsWith(SHRUNKEN_INDEX_PREFIX) && indexNameAndResp.getKey().contains(backingIndexName)) {

0 commit comments

Comments
 (0)