We had a unit test once which only failed on Sundays

Non-deterministic datetime parsing combined with a failure to mock the current time.

We were parsing the string "00-54" with the date format "YY-ww", where the "ww" indicates "ISO 8601 week number with leading zero", then serialising the resulting date object out with the same date format. Basically a round trip.

In this case, ISO week 54 of the year 2000 is actually an overflow condition (kind of like "February 30th"), and refers to ISO week 1 of the year 2001, which runs from Sunday 31 December 2000 to Saturday 6 January 2001 inclusive. The critical piece was that when no day of the week was specified at date parsing time, our parser filled in the current day of the week.

The expected behaviour, according to our test, was that when run on a Sunday the result would be "00-54" again, and that when run on Monday to Saturday it would return "01-01". Yes, rather than mock up the current date and run seven different cases, the test had been written to inspect the current day and then expect different results on different days. The actual behaviour demonstrated by our software was that the result was always "01-01". Most days this constituted a pass, but on Sundays it constituted a failure.

In this instance, the unit test was faulty and the software was displaying the correct behaviour. Correcting the unit test was trivial; I don't know if we ever did anything about that non-deterministic date parsing behaviour.

The test's author had left the department years earlier, and remains at large.