Kingsousse / myschedule

Automatically exported from code.google.com/p/myschedule
0 stars 0 forks source link

Intermittent unit test failures in SchedulerMainTest #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

The failure can occur during the execution of the unit tests.  The issue is 
intermittent.  It is not clear what circumstances can trigger it.

What is the expected output? What do you see instead?

Under certain circumstances, both of the tests contained in SchedulerMainTest 
can enter into a persistently failing state.  If the file deletion in the 
finally portion of the try block should fail after the temp file has been 
written to, then the file contents will contain additional data that causes an 
assertion failure.  In this case, the file will persist between VM executions, 
making failure permanent until the file is manually deleted.  I have not been 
able to determine what can cause the deletion to fail.

My suggestion is to add a call to ResultFile.resetFile() at the beginning of 
the try blocks.  This is the same strategy used by 
ScriptingSchedulerPluginTest, so it would be a consistent approach.

Original issue reported on code.google.com by joe.ra...@gmail.com on 6 Jul 2012 at 1:57

GoogleCodeExporter commented 9 years ago
Thank you for the report Joe! I will check this out later and update this issue.

Original comment by saltnlight5 on 6 Jul 2012 at 3:41

GoogleCodeExporter commented 9 years ago
Joe, I have improved the unit test by your suggestion. I aslo improved further 
by using the "target" as directoy output instead of OS temp folder. This might 
sometimes create problem, but the maven "target" ought to be more safe to write 
to during unit test.

Fixed in 7c2b17e85460.

Original comment by saltnlight5 on 6 Jul 2012 at 9:23