Skip to content

Commit d53a4a7

Browse files
authored
Test fix: Call explain only once in an assertBusy (elastic#139201)
1 parent fc7ac3c commit d53a4a7

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,6 @@ tests:
451451
- class: org.elasticsearch.index.mapper.LongSyntheticSourceNativeArrayIntegrationTests
452452
method: testSynthesizeArrayRandom
453453
issue: https://github.com/elastic/elasticsearch/issues/138819
454-
- class: org.elasticsearch.xpack.ilm.actions.DownsampleActionIT
455-
method: testILMWaitsForTimeSeriesEndTimeToLapse
456-
issue: https://github.com/elastic/elasticsearch/issues/138843
457454
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
458455
method: test {p0=search/610_function_score/formulating a function score query with a negative number returns bad request}
459456
issue: https://github.com/elastic/elasticsearch/issues/138908

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,16 @@ public void testILMWaitsForTimeSeriesEndTimeToLapse() throws Exception {
420420
rolloverMaxOneDocCondition(client(), dataStream);
421421

422422
assertBusy(() -> {
423+
Map<String, Object> explainResponse = explainIndex(client(), backingIndexName);
423424
assertThat(
424425
"index must wait in the " + WaitUntilTimeSeriesEndTimePassesStep.NAME + " until its end time lapses",
425-
explainIndex(client(), backingIndexName).get("step"),
426+
explainResponse.get("step"),
426427
is(WaitUntilTimeSeriesEndTimePassesStep.NAME)
427428
);
428429

429-
assertThat(explainIndex(client(), backingIndexName).get("step_info"), is(notNullValue()));
430+
assertThat(explainResponse.get("step_info"), is(notNullValue()));
430431
assertThat(
431-
(String) ((Map<String, Object>) explainIndex(client(), backingIndexName).get("step_info")).get("message"),
432+
(String) ((Map<String, Object>) explainResponse.get("step_info")).get("message"),
432433
containsString("Waiting until the index's time series end time lapses")
433434
);
434435
}, 30, TimeUnit.SECONDS);
@@ -630,8 +631,9 @@ public void testDownsampleTwiceSameInterval() throws Exception {
630631
assertThat(indexExists(downsampleIndexName), is(true));
631632
assertThat(indexExists(firstBackingIndex), is(false));
632633

633-
assertThat(explainIndex(client(), downsampleIndexName).get("step"), is(PhaseCompleteStep.NAME));
634-
assertThat(explainIndex(client(), downsampleIndexName).get("phase"), is("warm"));
634+
Map<String, Object> explainResponse = explainIndex(client(), downsampleIndexName);
635+
assertThat(explainResponse.get("step"), is(PhaseCompleteStep.NAME));
636+
assertThat(explainResponse.get("phase"), is("warm"));
635637

636638
Map<String, Object> settings = getOnlyIndexSettings(client(), downsampleIndexName);
637639
assertEquals(firstBackingIndex, settings.get(IndexMetadata.INDEX_DOWNSAMPLE_ORIGIN_NAME.getKey()));
@@ -674,8 +676,9 @@ public void testDownsampleTwiceSameInterval() throws Exception {
674676
// reach the cold/complete/complete step
675677
assertBusy(() -> {
676678
assertThat(indexExists(downsampleIndexName), is(true));
677-
assertThat(explainIndex(client(), downsampleIndexName).get("step"), is(PhaseCompleteStep.NAME));
678-
assertThat(explainIndex(client(), downsampleIndexName).get("phase"), is("cold"));
679+
Map<String, Object> explainResponse = explainIndex(client(), downsampleIndexName);
680+
assertThat(explainResponse.get("step"), is(PhaseCompleteStep.NAME));
681+
assertThat(explainResponse.get("phase"), is("cold"));
679682
Map<String, Object> settings = getOnlyIndexSettings(client(), downsampleIndexName);
680683
assertEquals(
681684
DownsampleConfig.SamplingMethod.getOrDefault(initialSamplingMethod).toString(),

0 commit comments

Comments
 (0)