Skip to content

Commit

Permalink
[Test] Account for auto-repairing for shard gen file
Browse files Browse the repository at this point in the history
Since elastic#112337, missing shard gen files are automatically reconstructed
based on the existing shard snapshot files. If the list of shard
snapshot files are completed, it means the repository is effectively not
corrupted. This PR updates the test to account for this situation.

Resolves: elastic#112769
  • Loading branch information
ywangd committed Sep 12, 2024
1 parent e6b15f4 commit ae199c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ tests:
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
method: test {yaml=reference/cluster/stats/line_1450}
issue: https://github.com/elastic/elasticsearch/issues/112732
- class: org.elasticsearch.repositories.blobstore.testkit.integrity.RepositoryVerifyIntegrityIT
method: testCorruption
issue: https://github.com/elastic/elasticsearch/issues/112769

# Examples:
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,21 @@ public void testCorruption() throws IOException {
? equalTo(testContext.indexNames().size())
: lessThan(testContext.indexNames().size())
);
assertThat(anomalies, not(empty()));
// Missing shard generation file is automatically repaired based on the shard snapshot files.
// See also BlobStoreRepository#buildBlobStoreIndexShardSnapshots
assertThat(anomalies, corruptedFileType == RepositoryFileType.SHARD_GENERATION ? empty() : not(empty()));
assertThat(responseObjectPath.evaluate("results.total_anomalies"), greaterThanOrEqualTo(anomalies.size()));
assertEquals("fail", responseObjectPath.evaluate("results.result"));
assertEquals(
corruptedFileType == RepositoryFileType.SHARD_GENERATION ? "pass" : "fail",
responseObjectPath.evaluate("results.result")
);

// remove permitted/expected anomalies to verify that no unexpected ones were seen
switch (corruptedFileType) {
case SNAPSHOT_INFO -> anomalies.remove("failed to load snapshot info");
case GLOBAL_METADATA -> anomalies.remove("failed to load global metadata");
case INDEX_METADATA -> anomalies.remove("failed to load index metadata");
case SHARD_GENERATION -> anomalies.remove("failed to load shard generation");
case SHARD_GENERATION -> {}
case SHARD_SNAPSHOT_INFO -> anomalies.remove("failed to load shard snapshot");
case SHARD_DATA -> {
anomalies.remove("missing blob");
Expand Down

0 comments on commit ae199c4

Please sign in to comment.