Skip to content

Commit aeab55e

Browse files
authored
Reduce flaxiness of ccr recovery timeouts test (#38035)
This fixes #38027. Currently we assert that all shards have failed. However, it is possible that some shards do not have segement files created yet. The action that we block is fetching these segement files so it is possible that some shards successfully recover. This commit changes the assertion to ensure that at least some of the shards have failed.
1 parent daafcb6 commit aeab55e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRepositoryIT.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
import static org.elasticsearch.snapshots.RestoreService.restoreInProgress;
5656
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
5757
import static org.hamcrest.Matchers.equalTo;
58+
import static org.hamcrest.Matchers.greaterThan;
5859
import static org.hamcrest.Matchers.instanceOf;
60+
import static org.hamcrest.Matchers.lessThan;
5961

6062
// TODO: Fold this integration test into a more expansive integration test as more bootstrap from remote work
6163
// TODO: is completed.
@@ -367,8 +369,9 @@ public void testIndividualActionsTimeout() throws Exception {
367369
// be marked as failed. Either one is a success for the purpose of this test.
368370
try {
369371
RestoreInfo restoreInfo = future.actionGet();
370-
assertEquals(0, restoreInfo.successfulShards());
371-
assertEquals(numberOfPrimaryShards, restoreInfo.failedShards());
372+
assertThat(restoreInfo.failedShards(), greaterThan(0));
373+
assertThat(restoreInfo.successfulShards(), lessThan(restoreInfo.totalShards()));
374+
assertEquals(numberOfPrimaryShards, restoreInfo.totalShards());
372375
} catch (Exception e) {
373376
assertThat(ExceptionsHelper.unwrapCause(e), instanceOf(ElasticsearchTimeoutException.class));
374377
}

0 commit comments

Comments
 (0)