When running the tests for the Tracker module, I get one failed test in about half the times I try (the rest of the time, all tests pass):

111 passes, 1 fail, 0 exceptions

Message:   New comments are counted on the tracker listing pages.
Group:     Other
Filename:  tracker.test
Line:      140
Function:  TrackerTest->testTrackerNewComments()

I believe this happens because the test runs "too fast". testTrackerNewComments() posts a comment as one user, then posts a comment as another user and finally gets the tracker of the first user. If all this happens within the same second, the two comments get the same timestamp. AFAICT comment_num_new() doesn't detect that the second comment was added later than the first and returns 0 even though it should return 1.

If you have troubles reproducing this, you can "make the seconds longer" by adding the following to the top of index.php: $_SERVER['REQUEST_TIME'] -= $_SERVER['REQUEST_TIME'] % 10;

As long as the comment module doesn't offer subsecond precision, we might just add a sleep(1) to the test between the posting of the two comments.

CommentFileSizeAuthor
#2 trackerfix.patch594 byteschx

Comments

catch’s picture

Component: tracker.module » tests
Priority: Normal » Critical

I get this sometimes too, since it's a test failiure, bumping to critical.

chx’s picture

Status: Active » Needs review
StatusFileSize
new594 bytes

Here we go. You guys have speedy machines :)

catch’s picture

hmm, I can't reproduce this bug today, it's very inconsistent. Seems sensible though. If someone else can reproduce consistently - please test this patch! Will try on my other machine later.

c960657’s picture

I just ran the test 10 times without the patch. The test failed 4 times.
I then ran the test 20 times with the patch. The test passed all runs.

So it looks like the patch fixes the problem.

catch’s picture

Status: Needs review » Reviewed & tested by the community

That's good enough for me :)

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Excellent. :) Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.