Skip to content

Commit

Permalink
Reduce flaxiness of ccr recovery timeouts test
Browse files Browse the repository at this point in the history
This fixes elastic#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.
  • Loading branch information
Tim-Brooks committed Jan 30, 2019
1 parent 53e80e9 commit 984207c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
import static org.elasticsearch.snapshots.RestoreService.restoreInProgress;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.lessThan;

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

0 comments on commit 984207c

Please sign in to comment.