rohangarg commented on code in PR #13741:
URL: https://github.com/apache/druid/pull/13741#discussion_r1098350573
##########
extensions-core/s3-extensions/src/test/java/org/apache/druid/storage/s3/output/S3StorageConnectorTest.java:
##########
@@ -104,9 +105,15 @@ public void pathExists() throws IOException
public void pathRead() throws IOException
{
EasyMock.reset(S3_CLIENT);
+ ObjectMetadata objectMetadata = new ObjectMetadata();
+ long contentLength = "test".getBytes(StandardCharsets.UTF_8).length;
+ objectMetadata.setContentLength(contentLength);
S3Object s3Object = new S3Object();
s3Object.setObjectContent(new
ByteArrayInputStream("test".getBytes(StandardCharsets.UTF_8)));
- EasyMock.expect(S3_CLIENT.getObject(new GetObjectRequest(BUCKET, PREFIX +
"/" + TEST_FILE))).andReturn(s3Object);
+
EasyMock.expect(S3_CLIENT.getObjectMetadata(EasyMock.anyObject())).andReturn(objectMetadata);
+ EasyMock.expect(S3_CLIENT.getObject(
+ new GetObjectRequest(BUCKET, PREFIX + "/" + TEST_FILE).withRange(0,
contentLength - 1))
+ ).andReturn(s3Object);
EasyMock.replay(S3_CLIENT);
Review Comment:
The configs from retries are removed and they are hard coded now. I think
for S3 in future, we can create a custom `S3RetryInputStream` which would be
easier to test for retries and can be used in all s3 read paths. I'm not sure
if we can test the multiplicative retries since we mock the AWSClient currently.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]