Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
While working on HDFS-14304 and HDFS-14348, it seems that libhdfs does not have great test coverage for failure paths. We found a few places in libhdfs where we are not propagating / handling exceptions properly. The goal of this JIRA is to improve test coverage for the failure / exception handling code in libhdfs.
I don't have a clear picture of how to do this, but here are some ideas:
(1) Create a dummy FileSystem where all operations throw an Exception and call into that FileSystem using libhdfs.
(2) We already do things like trying to open a file that does not exist, we can add tests that list a directory that does not exist, etc.
(3) It would be great if we could use some type of method stubbing (like Mockito in Java) for JNI methods, so we could test that our usage of the JNI is correct - e.g. if NewByteArray returns NULL do we actually throw an exception?