AlejandroMorgante commented on code in PR #18329:
URL: https://github.com/apache/iceberg/pull/18329#discussion_r4149514303


##########
aws/src/test/java/org/apache/iceberg/aws/s3/TestS3InputStream.java:
##########
@@ -55,20 +55,22 @@ void before() {
 
   @Test
   void testReadFullyClosesTheStream() throws IOException {
+    InputStream inputStream = spy(new ByteArrayInputStream(new byte[] {1}));
     when(s3Client.getObject(any(GetObjectRequest.class), 
any(ResponseTransformer.class)))
         .thenReturn(inputStream);
 
-    s3InputStream.readFully(0, new byte[0]);
+    s3InputStream.readFully(0, new byte[1]);

Review Comment:
   **Exactly!** 
   
   The zero-length read no longer opens an S3 stream, so this test now uses a 
nonzero read to verify that an opened stream is closed. The separate 
zero-length test verifies that no S3 request is made



-- 
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]

Reply via email to