This patch contains a number of fixes to existing unit tests that were either always failing, failing sporadically, or in one case failing for the wrong reasons. These changes are all mentioned below:
1) TimestampTest.testEscapes0007: This test was calling a stored procedure that was created as part of the tests, so would fail if your database defined have it predefined. The fix creates the procedure as part of the test.
2) ConnectionTest.testTimerStop: This test was explicitly looking for class files in the bin/ directory, but the ant build scripts would build them to build/classes and build/testclasses. Consequently it would fail if you didn't have, for example, a dev environment open that also was building the classes to bin/. The fix now looks in all of these locations.
3) ResultSetTest.testPessimisticConcurrency: The fix for bug#508 changed the error code that got returned when this test was run causing it to hang (when I ran it, it hung every single time, but it is sporadic). The test was changed to accept the new error code as well as the old ones.
4) SAfeTest.testSocketConcurrency4, SAfeTest.testCancel0001, SAfeTest.testCancel0003: These tests were sporadically failing due to the error code change in bug#508. As with the previous fix, these tests were changed to accept the new error code as well as the old ones.
5) DatabaseMetaDataTest.testBug575: This test appears to have been added in order to detect known issue in the library, however, the way the test was written meant that it would always fail even if the issue was fixed. This occurred because the assertion was comparing a string with an integer (the data type name vs the data type identifier). The test has been modified to compare the data type names - it does still fail - but now fails for the case it is trying to detect.
6) StatementTest.testCloseDeadlock: This test could sporadically fail particularly if the database connections were slow to establish for some reason, and so could fail for that reason as opposed to deadlock detection. The test has been modified so that the timeout doesn't start until all the connections have been successfully established.
The patch is attached and can also be found at https://gist.github.com/davidbryant/4d88f86288193b1018c8.
Anonymous