I finally figured out what I didn't like in all of our attempts to fix assertMollomWatchdogMessages():
Whenever we changed it, we basically destroyed the entire meaning of passing FALSE to assertMollomWatchdogMessages(); i.e., in order to not get false positive test results due to additional, non-severe messages being logged (e.g., server redirects and refreshes), we made any log message pass the assertion.
But if we use assertMollomWatchdogMessages(FALSE), then we have a unique expectation that must be verified: There must have been at least one severe log message, because we expect one.
Comments
Comment #2
sunGlad to see that this patch already revealed an invalid assertion.
Comment #3
dries commentedThis is certainly a clean-up. I was thinking; instead of
$positivewhy not a$max_severityso we can doJust a thought to explore. I think the word $positive is a bit funny in this context, and that a $max_severity would provide a bit more flexibility/expressiveness. I think that extra flexibility is required if we want to move this function to core per the @todo.
Comment #4
sunGood idea! Though I'm not sure whether we always want to test for an actual/precise watchdog message severity -- for most code, it only matters that there has been a severe message, and the severity used by the code should be able to be changed freely, as long as it remains severe.
So what we could do is to use $max_severity, but additionally make it accept a Boolean TRUE or FALSE, in case it only matters for the caller to distinguish between severe and non-severe messages (for which the logic could be changed or advanced later).
Comment #5
dries commentedGood idea! Though I'm not sure whether we always want to test for an actual/precise watchdog message severity -- for most code, it only matters that there has been a severe message, and the severity used by the code should be able to be changed freely, as long as it remains severe.
Wouldn't that mean we pass WATCHDOG_NOTICE in that case? Everything above WATCHDOG_NOTICE is considered to be severe, not? I'm not sure the extra boolean makes a difference.
Could you try a patch with the extra boolean?
Comment #6
sun#4: mollom-HEAD.assert-watchdog.4.patch queued for re-testing.
Comment #7
sunI guess you meant "without the extra boolean".
However, what I tried to say is that most tests will be fine by merely differing between "severe" (FALSE) and "non-severe" (TRUE) watchdog messages. By removing the Boolean logic, all tests have to pass an actual severity level constant; i.e., WATCHDOG_EMERGENCY instead of FALSE.
Comment #8
dries commentedGot it, and looks good now. Committed to CVS HEAD. Thanks.
Comment #9
sunStraight backport to D6. Fails for me locally. Testbot won't work, as usual.
Problem space being that I'm currently getting the following error sequence:
- There are only 2 servers in the server list.
- All servers redirect.
- No server is left and so the request fails.
While the client-side server fallback handling could certainly be improved, this problem seems to affect all clients right now. The last server in the server list must never return MOLLOM_REDIRECT. It either needs to handle the request, or it needs to respond with MOLLOM_REFRESH. Preferably the former.
Comment #10
sunThanks for reporting, reviewing, and testing! Committed to D6.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.