launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #08130
[Merge] lp:~frankban/launchpad/bug-1003097-isolation-failure into lp:launchpad
Francesco Banconi has proposed merging lp:~frankban/launchpad/bug-1003097-isolation-failure into lp:launchpad.
Requested reviews:
Launchpad Yellow Squad (yellow)
For more details, see:
https://code.launchpad.net/~frankban/launchpad/bug-1003097-isolation-failure/+merge/107024
== Summary ==
TestBugTaskView.test_rendered_query_counts_constant_with_team_memberships fails when run by itself during a query count assertion. This happen because the test is relying on a hot cache.
The cached query is::
SELECT id, product, project, distribution
FROM PillarName WHERE (id = (SELECT alias_for FROM PillarName WHERE name=u'ubuntu')
OR name=u'ubuntu')
AND alias_for IS NULL
LIMIT 1
Ths query is executed by Browser.open(TASK-URL) calls, indirectly invoked by other tests in the same TestCase.
== Changes ==
Increased the query count in the assertion.
NO-QA
== Tests ==
$ bin/test -vv -t lp.bugs.browser.tests.test_bugtask.TestBugTaskView
Running tests at level 1
Running lp.testing.layers.LaunchpadFunctionalLayer tests:
Set up lp.testing.layers.BaseLayer in 0.092 seconds.
Set up lp.testing.layers.DatabaseLayer in 2.330 seconds.
Set up lp.testing.layers.LibrarianLayer in 5.376 seconds.
Set up lp.testing.layers.MemcachedLayer in 0.128 seconds.
Set up lp.testing.layers.RabbitMQLayer in 2.557 seconds.
Set up lp.testing.layers.LaunchpadLayer in 0.000 seconds.
Set up lp.testing.layers.FunctionalLayer in 3.889 seconds.
Set up lp.testing.layers.LaunchpadFunctionalLayer in 0.000 seconds.
Running:
lp.bugs.browser.tests.test_bugtask.TestBugTaskView.test_bugtag_urls_are_encoded
lp.bugs.browser.tests.test_bugtask.TestBugTaskView.test_error_for_changing_target_with_invalid_status
lp.bugs.browser.tests.test_bugtask.TestBugTaskView.test_interesting_activity
lp.bugs.browser.tests.test_bugtask.TestBugTaskView.test_rendered_query_counts_constant_with_attachments
lp.bugs.browser.tests.test_bugtask.TestBugTaskView.test_rendered_query_counts_constant_with_team_memberships
lp.bugs.browser.tests.test_bugtask.TestBugTaskView.test_rendered_query_counts_reduced_with_branches
Ran 6 tests with 0 failures and 0 errors in 28.117 seconds.
Tearing down left over layers:
Tear down lp.testing.layers.LaunchpadFunctionalLayer in 0.000 seconds.
Tear down lp.testing.layers.LaunchpadLayer in 0.000 seconds.
Tear down lp.testing.layers.LibrarianLayer in 0.003 seconds.
Tear down lp.testing.layers.MemcachedLayer in 0.100 seconds.
Tear down lp.testing.layers.RabbitMQLayer ... not supported
Tear down lp.testing.layers.FunctionalLayer ... not supported
Tear down lp.testing.layers.DatabaseLayer in 0.607 seconds.
Tear down lp.testing.layers.BaseLayer in 0.002 seconds.
$ bin/test -vv -t lp.bugs.browser.tests.test_bugtask.TestBugTaskView.test_rendered_query_counts_constant_with_team_memberships
Running tests at level 1
Running lp.testing.layers.LaunchpadFunctionalLayer tests:
Set up lp.testing.layers.BaseLayer in 0.099 seconds.
Set up lp.testing.layers.DatabaseLayer in 2.417 seconds.
Set up lp.testing.layers.LibrarianLayer in 5.339 seconds.
Set up lp.testing.layers.MemcachedLayer in 0.113 seconds.
Set up lp.testing.layers.RabbitMQLayer in 2.076 seconds.
Set up lp.testing.layers.LaunchpadLayer in 0.000 seconds.
Set up lp.testing.layers.FunctionalLayer in 3.786 seconds.
Set up lp.testing.layers.LaunchpadFunctionalLayer in 0.000 seconds.
Running:
lp.bugs.browser.tests.test_bugtask.TestBugTaskView.test_rendered_query_counts_constant_with_team_memberships
Ran 1 tests with 0 failures and 0 errors in 5.914 seconds.
Tearing down left over layers:
Tear down lp.testing.layers.LaunchpadFunctionalLayer in 0.000 seconds.
Tear down lp.testing.layers.LaunchpadLayer in 0.000 seconds.
Tear down lp.testing.layers.LibrarianLayer in 0.004 seconds.
Tear down lp.testing.layers.MemcachedLayer in 0.101 seconds.
Tear down lp.testing.layers.RabbitMQLayer ... not supported
Tear down lp.testing.layers.FunctionalLayer ... not supported
Tear down lp.testing.layers.DatabaseLayer in 0.659 seconds.
Tear down lp.testing.layers.BaseLayer in 0.002 seconds.
--
https://code.launchpad.net/~frankban/launchpad/bug-1003097-isolation-failure/+merge/107024
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/bugs/browser/tests/test_bugtask.py'
--- lib/lp/bugs/browser/tests/test_bugtask.py 2012-05-10 22:48:06 +0000
+++ lib/lp/bugs/browser/tests/test_bugtask.py 2012-05-23 14:31:00 +0000
@@ -140,7 +140,12 @@
self.getUserBrowser(url, person_no_teams)
# This may seem large: it is; there is easily another 30% fat in
# there.
- self.assertThat(recorder, HasQueryCount(LessThan(88)))
+ # If this test is run in isolation, the query count is 88.
+ # Other tests in this TestCase could cache the
+ # "SELECT id, product, project, distribution FROM PillarName ..."
+ # query by previously browsing the task url, in which case the
+ # query count is decreased by one.
+ self.assertThat(recorder, HasQueryCount(LessThan(89)))
count_with_no_teams = recorder.count
# count with many teams
self.invalidate_caches(task)
Follow ups