Skip to content

Commit d8a3fc2

Browse files
arteamywangdelasticmachine
authored
[test] Don't test any 7.x snapshots in testLogicallyEquivalentSnapshotIsUsedEvenIfFilesAreDifferent (#114821)
Don't test any 7.x snapshots, keep using any 8,x compatible snapshot and Lucene version. Originally added in 8.0 (#77420) for testing peer recoveries using snapshots. Co-authored-by: Yang Wang <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
1 parent d7a9575 commit d8a3fc2

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

x-pack/plugin/snapshot-based-recoveries/src/test/java/org/elasticsearch/xpack/snapshotbasedrecoveries/recovery/plan/SnapshotsRecoveryPlannerServiceTests.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,12 @@
2626
import org.elasticsearch.common.unit.ByteSizeValue;
2727
import org.elasticsearch.core.CheckedConsumer;
2828
import org.elasticsearch.core.IOUtils;
29-
import org.elasticsearch.core.UpdateForV9;
3029
import org.elasticsearch.index.IndexSettings;
3130
import org.elasticsearch.index.IndexVersion;
32-
import org.elasticsearch.index.IndexVersions;
3331
import org.elasticsearch.index.shard.ShardId;
3432
import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot;
3533
import org.elasticsearch.index.store.Store;
3634
import org.elasticsearch.index.store.StoreFileMetadata;
37-
import org.elasticsearch.indices.recovery.RecoverySettings;
3835
import org.elasticsearch.indices.recovery.plan.ShardRecoveryPlan;
3936
import org.elasticsearch.indices.recovery.plan.ShardSnapshot;
4037
import org.elasticsearch.indices.recovery.plan.ShardSnapshotsService;
@@ -63,7 +60,6 @@
6360
import static org.elasticsearch.common.util.CollectionUtils.iterableAsArrayList;
6461
import static org.elasticsearch.index.engine.Engine.ES_VERSION;
6562
import static org.elasticsearch.index.engine.Engine.HISTORY_UUID_KEY;
66-
import static org.elasticsearch.test.index.IndexVersionUtils.randomVersionBetween;
6763
import static org.hamcrest.Matchers.empty;
6864
import static org.hamcrest.Matchers.equalTo;
6965
import static org.hamcrest.Matchers.greaterThan;
@@ -203,8 +199,6 @@ public void fetchLatestSnapshotsForShard(ShardId shardId, ActionListener<Optiona
203199
});
204200
}
205201

206-
@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION)
207-
@AwaitsFix(bugUrl = "this is testing pre-7.0 upgrade behavior so probably needs some updating")
208202
public void testLogicallyEquivalentSnapshotIsUsedEvenIfFilesAreDifferent() throws Exception {
209203
createStore(store -> {
210204
boolean shareFilesWithSource = randomBoolean();
@@ -217,18 +211,8 @@ public void testLogicallyEquivalentSnapshotIsUsedEvenIfFilesAreDifferent() throw
217211
final IndexVersion snapshotVersion;
218212
final Version luceneVersion;
219213
if (compatibleVersion) {
220-
snapshotVersion = randomBoolean() ? null : IndexVersionUtils.randomCompatibleVersion(random());
221-
// If snapshotVersion is not present,
222-
// then lucene version must be < RecoverySettings.SEQ_NO_SNAPSHOT_RECOVERIES_SUPPORTED_VERSION
223-
if (snapshotVersion == null) {
224-
luceneVersion = randomVersionBetween(
225-
random(),
226-
IndexVersions.V_7_0_0,
227-
RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_INDEX_VERSION
228-
).luceneVersion();
229-
} else {
230-
luceneVersion = IndexVersionUtils.randomCompatibleVersion(random()).luceneVersion();
231-
}
214+
snapshotVersion = IndexVersionUtils.randomCompatibleVersion(random());
215+
luceneVersion = snapshotVersion.luceneVersion();
232216
} else {
233217
snapshotVersion = IndexVersion.fromId(Integer.MAX_VALUE);
234218
luceneVersion = org.apache.lucene.util.Version.parse("255.255.255");

0 commit comments

Comments
 (0)