Race condition in TestDiffInScripts.test_fromFile_withError

Bug #567257 reported by Jeroen T. Vermeulen
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Tim Penhey

Bug Description

This test underwent a spurious failure recently: TestDiffInScripts.test_fromFile_withError in lib/lp/code/model/tests/test_diff.py. For reference, see also lib/canonical/launchpad/webapp/errorlog.py.

The problem is with the way it tries to prove that a particular operation generates an oops. It does this by recording the error reporting utility's lastid before the operation. Then at the end, after performing the operation, compares the current value to the one it's recorded. This can produce false failures when a date rollover targets oopses to a new directory, resetting the lastid counter to zero. Thus the new lastid value may legitimately be the same as the old one, even though an oops has been generated.

Fixing the test is easy: compare lasterrordir as well as lastid. At least one of the two must change when an oops is generated. But as BjornT points out, it would be nice to have a simple guaranteed incrementing id for testing oopses. The fix leaves open a similar race condition where it's possible for failure to generate an oops may go unnoticed during date rollover.

Related branches

Revision history for this message
Karl Fogel (kfogel) wrote :

Filed bug #567689 about the general problem of not having a reliable way to test OOPS generation.

Tim Penhey (thumper)
tags: added: spurious-test-failure tech-debt
Changed in launchpad-code:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I'm going to disable the failing assertion.

Revision history for this message
Aaron Bentley (abentley) wrote :

Michael, why not fix it as described?

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Because I was too angry.

Revision history for this message
Tim Penhey (thumper) wrote :

If we know how to fix it, and it covers a real test case, then we should fix it. Marking it High.

Changed in launchpad-code:
importance: Low → High
Tim Penhey (thumper)
Changed in launchpad-code:
status: Triaged → In Progress
assignee: nobody → Tim Penhey (thumper)
milestone: none → 10.04
Revision history for this message
Ursula Junque (ursinha) wrote : Bug fixed by a commit
Changed in launchpad-code:
status: In Progress → Fix Committed
tags: added: qa-needstesting
Tim Penhey (thumper)
tags: added: qa-untestable
removed: qa-needstesting
Tim Penhey (thumper)
Changed in launchpad-code:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.