Test isolation: some test is switching to readonly mode and not switching back on teardown

Bug #954319 reported by Gary Poster
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Benji York

Bug Description

Here is a triplet of tests that provoke the get-stuck-in-read-only-mode
problem when run together:

lp.services.database.tests.test_readonly.Test_is_read_only.test_cached_value_takes_precedence
lp.services.webapp.tests.test_dbpolicy.LayerDatabasePolicyTestCase.test_WebServiceRequest_uses_LaunchpadDatabasePolicy
lp.services.webapp.tests.test_dbpolicy.LayerDatabasePolicyTestCase.test_WebServiceRequest_uses_ReadOnlyDatabasePolicy

(You can put the above three lines in a file and run the tests with
bin/test --load-list the_file.)

The first test appears to pass, the second then reports

    AssertionError: newInteraction called while another interaction is active.

The third then fails thusly:

Failure in test lp.services.webapp.tests.test_dbpolicy.LayerDatabasePolicyTestCase.test_WebServiceRequest_uses_ReadOnlyDatabasePolicy
Traceback (most recent call last):
_StringException: Traceback (most recent call last):
  File "/home/benji/launchpad/lp-branches/test-failures-1/lib/lp/services/webapp/tests/test_dbpolicy.py", line 237, in test_WebServiceRequest_uses_ReadOnlyDatabasePolicy
    touch_read_only_file()
  File "/home/benji/launchpad/lp-branches/test-failures-1/lib/lp/services/database/tests/readonly.py", line 39, in touch_read_only_file
    assert is_read_only(), "Switching to read-only failed."
AssertionError: Switching to read-only failed.

As a bonus, replace the first test with

lp.services.database.tests.test_readonly.Test_is_read_only.test_caching_in_request

And the same things will happen, except that the third test will switch
to failing this way:

Failure in test lp.services.webapp.tests.test_dbpolicy.LayerDatabasePolicyTestCase.test_WebServiceRequest_uses_ReadOnlyDatabasePolicy
Traceback (most recent call last):
_StringException: Traceback (most recent call last):
  File "/home/benji/launchpad/lp-branches/test-failures-1/lib/lp/services/webapp/tests/test_dbpolicy.py", line 247, in test_WebServiceRequest_uses_ReadOnlyDatabasePolicy
    remove_read_only_file()
  File "/home/benji/launchpad/lp-branches/test-failures-1/lib/lp/services/database/tests/readonly.py", line 55, in remove_read_only_file
    assert not is_read_only(), "Switching to read-write failed."
AssertionError: Switching to read-write failed.

Related branches

Revision history for this message
Gary Poster (gary) wrote :
Benji York (benji)
description: updated
Gary Poster (gary)
Changed in launchpad:
assignee: nobody → Benji York (benji)
Benji York (benji)
description: updated
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Changed in launchpad:
status: Triaged → 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

Bug attachments

Remote bug watches

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