diff --git a/test/framework/src/main/java/org/elasticsearch/common/lucene/store/ESIndexInputTestCase.java b/test/framework/src/main/java/org/elasticsearch/common/lucene/store/ESIndexInputTestCase.java index 99873f81894a5..18cae3eee87d3 100644 --- a/test/framework/src/main/java/org/elasticsearch/common/lucene/store/ESIndexInputTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/common/lucene/store/ESIndexInputTestCase.java @@ -72,7 +72,8 @@ protected byte[] randomReadAndSlice(IndexInput indexInput, int length) throws IO case 3: // Read using slice len = randomIntBetween(1, length - readPos); - IndexInput slice = indexInput.slice(randomAlphaOfLength(10) + randomFileExtension(), readPos, len); + final String sliceExtension = randomValueOtherThan(".cfs", ESIndexInputTestCase::randomFileExtension); + IndexInput slice = indexInput.slice(randomAlphaOfLength(10) + sliceExtension, readPos, len); temp = randomReadAndSlice(slice, len); // assert that position in the original input didn't change assertEquals(readPos, indexInput.getFilePointer()); @@ -121,7 +122,8 @@ protected void doRun() throws Exception { clone = indexInput.clone(); } else { final int sliceEnd = between(readEnd, length); - clone = indexInput.slice("slice" + randomAlphaOfLength(10) + randomFileExtension(), 0L, sliceEnd); + final String sliceExtension = randomValueOtherThan(".cfs", ESIndexInputTestCase::randomFileExtension); + clone = indexInput.slice("slice" + randomAlphaOfLength(10) + sliceExtension, 0L, sliceEnd); } startLatch.countDown(); startLatch.await(); diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryStatsTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryStatsTests.java index b399c3c7c8a87..fbed51040bba5 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryStatsTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryStatsTests.java @@ -19,6 +19,7 @@ import org.elasticsearch.common.TriConsumer; import org.elasticsearch.common.UUIDs; import org.elasticsearch.common.blobstore.BlobContainer; +import org.elasticsearch.common.lucene.store.ESIndexInputTestCase; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -605,8 +606,14 @@ private void executeTestCase( final TriConsumer test ) throws Exception { + final String fileName; + if (SearchableSnapshots.SNAPSHOT_PARTIAL_SETTING.get(indexSettings)) { + fileName = randomAlphaOfLength(10) + randomValueOtherThan(".cfs", ESIndexInputTestCase::randomFileExtension); + } else { + fileName = randomAlphaOfLength(10) + randomFileExtension(); + } + final byte[] fileContent = randomByteArrayOfLength(randomIntBetween(10, MAX_FILE_LENGTH)); - final String fileName = randomAlphaOfLength(10) + randomFileExtension(); final SnapshotId snapshotId = new SnapshotId("_name", "_uuid"); final IndexId indexId = new IndexId("_name", "_uuid"); final ShardId shardId = new ShardId("_name", "_uuid", 0);