Skip to content

Commit 63d6018

Browse files
committed
Use retrying purpose when we expect reads to succeed
1 parent 9da242f commit 63d6018

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/framework/src/main/java/org/elasticsearch/repositories/blobstore/ESBlobStoreRepositoryIntegTestCase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
import static org.elasticsearch.repositories.blobstore.BlobStoreRepository.SNAPSHOT_NAME_FORMAT;
6666
import static org.elasticsearch.repositories.blobstore.BlobStoreTestUtil.randomNonDataPurpose;
6767
import static org.elasticsearch.repositories.blobstore.BlobStoreTestUtil.randomPurpose;
68+
import static org.elasticsearch.repositories.blobstore.BlobStoreTestUtil.randomRetryingPurpose;
6869
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
6970
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
7071
import static org.hamcrest.Matchers.equalTo;
@@ -157,7 +158,7 @@ public void testWriteMaybeCopyRead() throws IOException {
157158
readBlobName = destinationBlobName;
158159
} catch (UnsupportedOperationException ignored) {}
159160
}
160-
try (InputStream stream = container.readBlob(randomPurpose(), readBlobName)) {
161+
try (InputStream stream = container.readBlob(randomRetryingPurpose(), readBlobName)) {
161162
BytesRefBuilder target = new BytesRefBuilder();
162163
while (target.length() < data.length) {
163164
byte[] buffer = new byte[scaledRandomIntBetween(1, data.length - target.length())];
@@ -285,7 +286,7 @@ public static byte[] writeRandomBlob(BlobContainer container, String name, int l
285286

286287
public static byte[] readBlobFully(BlobContainer container, String name, int length) throws IOException {
287288
byte[] data = new byte[length];
288-
try (InputStream inputStream = container.readBlob(randomPurpose(), name)) {
289+
try (InputStream inputStream = container.readBlob(randomRetryingPurpose(), name)) {
289290
assertThat(Streams.readFully(inputStream, data), CoreMatchers.equalTo(length));
290291
assertThat(inputStream.read(), CoreMatchers.equalTo(-1));
291292
}

0 commit comments

Comments
 (0)