← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~bac/launchpad/bug-996773-2 into lp:launchpad

 

Brad Crittenden has proposed merging lp:~bac/launchpad/bug-996773-2 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #996773 in Launchpad itself: "lp.bugs.tests.test_bugchanges.TestBugChanges.test_change_information_type_using_api fails intermittently/rarely in parallel tests"
  https://bugs.launchpad.net/launchpad/+bug/996773

For more details, see:
https://code.launchpad.net/~bac/launchpad/bug-996773-2/+merge/105499

= Summary =

WADL generation by test_wadl was generating HTTPS urls and then
caching the WADL.  Subsequent API tests would then get the cached WADL
and attempt to make HTTPS connections which were then refused as only
HTTP connections are supported in our test framework.

== Proposed fix ==

Have test_wadl restore the value of the cached WADL at the end of its
run.

== Pre-implementation notes ==

Helpful discussions with Gary and Francesco.

== Tests ==

To fully test, test_wadl needs to be run first.  Add the following to
a file (e.g. 'tests.txt') and then use --load-list:

lp.services.webservice.tests.test_wadl_generation.SmokeTestWadlAndDocGeneration.test_wadl
lp.bugs.tests.test_bugchanges.TestBugChanges.test_change_information_type_using_api

bin/test -vvt --load-list tests.txt

== Demo and Q/A ==

None

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/services/webservice/tests/test_wadl_generation.py
-- 
https://code.launchpad.net/~bac/launchpad/bug-996773-2/+merge/105499
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/launchpad/bug-996773-2 into lp:launchpad.
=== modified file 'lib/lp/services/webservice/tests/test_wadl_generation.py'
--- lib/lp/services/webservice/tests/test_wadl_generation.py	2012-01-01 02:58:52 +0000
+++ lib/lp/services/webservice/tests/test_wadl_generation.py	2012-05-11 15:57:20 +0000
@@ -13,6 +13,7 @@
     generate_json,
     generate_wadl,
     )
+from lp.systemhomes import WebServiceApplication
 from lp.testing import TestCase
 from lp.testing.layers import LaunchpadFunctionalLayer
 
@@ -23,10 +24,12 @@
     layer = LaunchpadFunctionalLayer
 
     def test_wadl(self):
+        preexisting_wadl_cache = WebServiceApplication.cached_wadl
         config = getUtility(IWebServiceConfiguration)
         for version in config.active_versions:
             wadl = generate_wadl(version)
             self.assertThat(wadl[:40], StartsWith('<?xml '))
+        WebServiceApplication.cached_wadl = preexisting_wadl_cache
 
     def test_json(self):
         config = getUtility(IWebServiceConfiguration)


Follow ups