Export to GitHub

myschedule - issue #91

Intermittent unit test failures in SchedulerMainTest


Posted on Jul 6, 2012 by Swift Bird

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.

Comment #1

Posted on Jul 6, 2012 by Massive Dog

Thank you for the report Joe! I will check this out later and update this issue.

Comment #2

Posted on Jul 6, 2012 by Massive Dog

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.

Status: Fixed

Labels:
Type-Defect Priority-Medium Release-2.4.4