test_rosetta_branches_script_oops fails intermittently when run out of order because of bug 884036

Bug #984312 reported by Gary Poster
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Graham Binns

Bug Description

lp.translations.tests.test_rosetta_branches_script.TestRosettaBranchesScript.test_rosetta_branches_script_oops fails intermittently when tests are run in random order (as with --shuffle and as with parallel testing generally) because oops entries like those described in bug 884036...

> Exception-Type: AssertionError
> Exception-Value: Bug #504291: Store left in a disconnected state.

> Exception-Type: DisconnectionError
> Exception-Value: terminating connection due to administrator command server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.

...pollute the oops values returned when the oops values are synced. There is already code to handle the case of tests being run in order (8 of these occur) or in isolation (0 of these occur), but not to handle all possible variations

One approach to solving this is to address bug 884036.

Another approach, which I advocate for the parallel testing effort, is to filter out oopses matching the two descriptions above before checking the len of oopses. This would mean a change from this test code...

        # XXX: Robert Collins - bug 884036 - test_rosetta_branches_script does
        # a commit() which resets the test db out from under the running slave
        # appserver, requests to it then (correctly) log oopses as a DB
        # connection is *not normal*. So when both tests are run, we see 8 of
        # these oopses (4 pairs of 2); when run alone we don't.
        self.oops_capture.sync()
        self.assertThat(
            len(self.oopses), MatchesAny(Equals(1), Equals(9)),
            "Unexpected number of OOPSes %r" % self.oopses)
        oops_report = self.oopses[-1]

...to something like this test code.

        self.oops_capture.sync()
        # XXX: Robert Collins - bug 884036 - tests such as
        # test_rosetta_branches_script perform
        # a commit() which resets the test db out from under the running slave
        # appserver. Requests to it then (correctly) log oopses as a DB
        # connection is *not normal*. So when tests like this are run, we see
        # DisconnectionErrors; when run alone we don't. We filter the
        # spurious oopses out before making our checks.
        oopses = filter_out_disconnection_oopses(self.oopses)
        self.assertThat(
            len(oopses), Equals(1),
            "Unexpected number of OOPSes %r" % self.oopses)
        oops_report = oopses[-1]

The code in filter_out_disconnection_oopses is left as an exercise to the reader. :-P

Related branches

Graham Binns (gmb)
Changed in launchpad:
status: Triaged → In Progress
assignee: nobody → Graham Binns (gmb)
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Changed in launchpad:
status: In Progress → Fix Committed
William Grant (wgrant)
tags: added: qa-untestable
removed: qa-needstesting
William Grant (wgrant)
Changed in launchpad:
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.