Gargi-jais11 commented on PR #9628: URL: https://github.com/apache/ozone/pull/9628#issuecomment-3741953906
Below the few test cases suggestion which I could think as of now: 1. Exception during close() — partial resource cleanup - Test: If `channel.close()` throws IOException, verify r`af.close()` is still called - Test: If `raf.close()` throws IOException, verify `channel.close()` was already attempted - Rationale: close() catches exceptions but must attempt to close both resources even if one fails to prevent file descriptor leaks. 2. Partial initialization failure - Test: Simulate `open() `failing after setting blockFile but before raf/channel are set - Verify: close() handles null raf/channel gracefully (null checks exist, but should be tested) - Rationale: If open() throws mid-initialization, close() must handle partial state safely. 3. Zero-sized buffer - Test: read() with ByteBuffer.allocate(0) — buffer has no remaining capacity - Expected: Should return immediately without reading; verify return value - Rationale: Edge case that could cause infinite loops or incorrect behavior. It would be great @rich7420 if you come up with some more critical tests. -- 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]
