Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
I did a little test, and found that aborting unit tests halfway through (for example, with the stop button in Eclipse) will NOT invoke the @After functions.
Needless to say, this could have bad consequences for test users. A developer might press control-C in the middle of a unit test, and then find that he was unable to successfully re-run that test again because of the lingering state. A Jenkins build machine might experience a JVM crash because of an out-of-memory condition, and then find that all builds turned red because a unit test failed to clean up the state which it created.
I think that in HDFS tests which alter persistent state, we probably should invoke the @After functions from a @Before function, just to make sure that the necessary cleanup is done. Otherwise, we might be risking unrepeatable test failures.