steveloughran commented on a change in pull request #2159:
URL: https://github.com/apache/iceberg/pull/2159#discussion_r566830591



##########
File path: aws/src/test/java/org/apache/iceberg/aws/s3/S3OutputStreamTest.java
##########
@@ -133,6 +134,53 @@ public void testAbortMultipart() {
     }
   }
 
+  @Test(expected = IllegalStateException.class)
+  public void testFailWriteIntAfterAsyncError() throws Exception {
+    doThrow(new 
RuntimeException()).when(s3mock).uploadPart((UploadPartRequest) any(), 
(RequestBody) any());
+    S3OutputStream stream = new S3OutputStream(s3mock, randomURI(), 
properties);
+    stream.write(randomData(10 * 1024 * 1024));
+    final long startTs = System.currentTimeMillis();
+    while (stream.getAsyncError() == null && System.currentTimeMillis() - 
startTs <= 1000) {
+      Thread.sleep(1);
+    }
+    Assert.assertNotNull(stream.getAsyncError());
+    try {
+      stream.write(1);
+    } finally {
+      stream.close();
+    }
+  }
+
+  @Test(expected = IllegalStateException.class)
+  public void testFailWriteArrayAfterAsyncError() throws Exception {
+    doThrow(new 
RuntimeException()).when(s3mock).uploadPart((UploadPartRequest) any(), 
(RequestBody) any());
+    S3OutputStream stream = new S3OutputStream(s3mock, randomURI(), 
properties);
+    stream.write(randomData(10 * 1024 * 1024));
+    final long startTs = System.currentTimeMillis();
+    while (stream.getAsyncError() == null && System.currentTimeMillis() - 
startTs <= 1000) {
+      Thread.sleep(1);
+    }
+    Assert.assertNotNull(stream.getAsyncError());
+    try {

Review comment:
       ok.




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

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