gaborkaszab commented on code in PR #17329:
URL: https://github.com/apache/iceberg/pull/17329#discussion_r3657284025
##########
api/src/test/java/org/apache/iceberg/encryption/TestEncryptingFileIO.java:
##########
@@ -151,6 +154,39 @@ public void closeClosesEncryptionManagerWhenCloseable()
throws Exception {
verify((Closeable) em).close();
}
+ @Test
+ public void closeClosesEncryptionManagerWhenFileIOCloseFails() throws
Exception {
+ RuntimeException fileIOFailure = new RuntimeException("FileIO close
failure");
+ EncryptionManager em =
+ mock(EncryptionManager.class,
withSettings().extraInterfaces(Closeable.class));
+ DelegateFileIO delegate = mock(DelegateFileIO.class);
+ doThrow(fileIOFailure).when(delegate).close();
+
+ EncryptingFileIO fileIO = EncryptingFileIO.combine(delegate, em);
+
+ assertThatThrownBy(fileIO::close).isSameAs(fileIOFailure);
+ verify((Closeable) em).close();
+ }
+
+ @Test
+ public void closeSuppressesEncryptionManagerFailureWhenFileIOCloseFails()
throws Exception {
Review Comment:
The use case in this test doesn't seem a requirement, rather a side effect
of the implementation (pre this PR and with this PR too). I'm not sure we want
to pin this down with a test.
--
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]