Skip to content

Commit e1f7814

Browse files
authored
[Test] Account for auto-repairing for shard gen file (elastic#112778)
Since elastic#112337, missing shard gen files are automatically reconstructed based on the existing shard snapshot files. If the list of shard snapshot files is complete, it means the repository is effectively not corrupted. This PR updates the test to account for this situation. Resolves: elastic#112769
1 parent e22bef6 commit e1f7814

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,6 @@ tests:
208208
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
209209
method: test {yaml=reference/cluster/stats/line_1450}
210210
issue: https://github.com/elastic/elasticsearch/issues/112732
211-
- class: org.elasticsearch.repositories.blobstore.testkit.integrity.RepositoryVerifyIntegrityIT
212-
method: testCorruption
213-
issue: https://github.com/elastic/elasticsearch/issues/112769
214211
- class: org.elasticsearch.script.StatsSummaryTests
215212
method: testEqualsAndHashCode
216213
issue: https://github.com/elastic/elasticsearch/issues/112439

x-pack/plugin/snapshot-repo-test-kit/src/internalClusterTest/java/org/elasticsearch/repositories/blobstore/testkit/integrity/RepositoryVerifyIntegrityIT.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,23 @@ public void testCorruption() throws IOException {
344344
? equalTo(testContext.indexNames().size())
345345
: lessThan(testContext.indexNames().size())
346346
);
347-
assertThat(anomalies, not(empty()));
347+
// Missing shard generation file is automatically repaired based on the shard snapshot files.
348+
// See also BlobStoreRepository#buildBlobStoreIndexShardSnapshots
349+
final boolean deletedShardGen = corruptedFileType == RepositoryFileType.SHARD_GENERATION && Files.exists(corruptedFile) == false;
350+
assertThat(anomalies, deletedShardGen ? empty() : not(empty()));
348351
assertThat(responseObjectPath.evaluate("results.total_anomalies"), greaterThanOrEqualTo(anomalies.size()));
349-
assertEquals("fail", responseObjectPath.evaluate("results.result"));
352+
assertEquals(deletedShardGen ? "pass" : "fail", responseObjectPath.evaluate("results.result"));
350353

351354
// remove permitted/expected anomalies to verify that no unexpected ones were seen
352355
switch (corruptedFileType) {
353356
case SNAPSHOT_INFO -> anomalies.remove("failed to load snapshot info");
354357
case GLOBAL_METADATA -> anomalies.remove("failed to load global metadata");
355358
case INDEX_METADATA -> anomalies.remove("failed to load index metadata");
356-
case SHARD_GENERATION -> anomalies.remove("failed to load shard generation");
359+
case SHARD_GENERATION -> {
360+
if (deletedShardGen == false) {
361+
anomalies.remove("failed to load shard generation");
362+
}
363+
}
357364
case SHARD_SNAPSHOT_INFO -> anomalies.remove("failed to load shard snapshot");
358365
case SHARD_DATA -> {
359366
anomalies.remove("missing blob");

0 commit comments

Comments
 (0)