← Back to team overview

yellow team mailing list archive

[Merge] lp:~frankban/launchpad/bug-985338-programming-error into lp:launchpad

 

Francesco Banconi has proposed merging lp:~frankban/launchpad/bug-985338-programming-error into lp:launchpad.

Requested reviews:
  Launchpad Yellow Squad (yellow)
Related bugs:
  Bug #985338 in Launchpad itself: "lp.testing.tests.test_pgsql.TestPgTestSetupTuning.testOptimization fails intermittently in parallel tests with ProgrammingError"
  https://bugs.launchpad.net/launchpad/+bug/985338

For more details, see:
https://code.launchpad.net/~frankban/launchpad/bug-985338-programming-error/+merge/102815

= Summary =

lp.testing.tests.test_pgsql.TestPgTestSetupTuning.testOptimization 
intermittently raises a ProgrammingError. This happens when the test is run
after test_sequences (in the same TestCase). The latter doesn't destroy the
database used for tests, and so the former generates an error attempting
to create an existing table.


== Proposed fix ==

Drop the database in test_sequences.


== Implementation details ==

See proposed fix.

== Tests ==

$ bin/test -vv -t lp.testing.tests.test_pgsql.TestPgTestSetupTuning
Running tests at level 1
Running lp.testing.layers.BaseLayer tests:
  Set up lp.testing.layers.BaseLayer in 0.070 seconds.
  Running:
 testOptimization (lp.testing.tests.test_pgsql.TestPgTestSetupTuning)
 test_sequences (lp.testing.tests.test_pgsql.TestPgTestSetupTuning)
  Ran 2 tests with 0 failures and 0 errors in 1.474 seconds.
Tearing down left over layers:
  Tear down lp.testing.layers.BaseLayer in 0.001 seconds.

$ bin/test -vv --shuffle -t lp.testing.tests.test_pgsql.TestPgTestSetupTuning
Running tests at level 1
Running lp.testing.layers.BaseLayer tests:
  Set up lp.testing.layers.BaseLayer in 0.070 seconds.
  Running:
 test_sequences (lp.testing.tests.test_pgsql.TestPgTestSetupTuning)
 testOptimization (lp.testing.tests.test_pgsql.TestPgTestSetupTuning)
  Ran 2 tests with 0 failures and 0 errors in 1.484 seconds.
Tearing down left over layers:
  Tear down lp.testing.layers.BaseLayer in 0.001 seconds.
Tests were shuffled using seed number 341718873136.


== Demo and Q/A ==

no-qa


== lint ==

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/testing/tests/test_pgsql.py

-- 
https://code.launchpad.net/~frankban/launchpad/bug-985338-programming-error/+merge/102815
Your team Launchpad Yellow Squad is requested to review the proposed merge of lp:~frankban/launchpad/bug-985338-programming-error into lp:launchpad.
=== modified file 'lib/lp/testing/tests/test_pgsql.py'
--- lib/lp/testing/tests/test_pgsql.py	2011-12-29 05:29:36 +0000
+++ lib/lp/testing/tests/test_pgsql.py	2012-04-20 08:38:21 +0000
@@ -193,3 +193,8 @@
         # Fail if we got a diffent sequence value at some point
         for v in sequence_values:
             self.failUnlessEqual(v, sequence_values[0])
+
+        # The database still exists because, after the last commit,
+        # ConnectionWrapper.committed was set to False.
+        # Drop the database here to avoid test ordering issues.
+        fixture.dropDb()