← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:testfix-swiftclient into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:testfix-swiftclient into launchpad:master.

Commit message:
Fix test failures with swiftclient 3.9.0

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/391560

Newer versions of swiftclient (maybe >= 3.0.0?) do a better job of retrying when the server is flapping, so stop testing that they don't.

Also, the fix for https://bugs.launchpad.net/python-swiftclient/+bug/1838775 caused an uncollectable reference cycle on Python 2.  This was reported (in a somewhat different form) in https://bugs.launchpad.net/python-swiftclient/+bug/1873435 and has been fixed upstream, but the fix hasn't been released yet, so just back off a little to python-swiftclient 3.8.1.

Dependencies MP: https://code.launchpad.net/~cjwatson/lp-source-dependencies/+git/lp-source-dependencies/+merge/391559
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:testfix-swiftclient into launchpad:master.
diff --git a/constraints.txt b/constraints.txt
index 81128f1..2f395d8 100644
--- a/constraints.txt
+++ b/constraints.txt
@@ -282,7 +282,7 @@ python-memcached==1.58
 # https://github.com/ziima/python-openid/pull/47
 # lp1 Fix normalization of non-ASCII query strings on Python 2.
 python-openid2==3.2+lp1
-python-swiftclient==3.9.0
+python-swiftclient==3.8.1
 PyYAML==3.10
 rabbitfixture==0.4.2
 requests-file==1.4.3
diff --git a/lib/lp/testing/swift/tests/test_fixture.py b/lib/lp/testing/swift/tests/test_fixture.py
index 234a80f..b03507f 100644
--- a/lib/lp/testing/swift/tests/test_fixture.py
+++ b/lib/lp/testing/swift/tests/test_fixture.py
@@ -175,11 +175,7 @@ class TestSwiftFixture(TestCase):
 
     def test_shutdown_and_startup(self):
         # This test demonstrates how the Swift client deals with a
-        # flapping Swift server. In particular, that once a connection
-        # has started failing it will continue failing so we need to
-        # ensure that once we encounter a fail we open a fresh
-        # connection. This is probably a property of our mock Swift
-        # server rather than reality but the mock is a required target.
+        # flapping Swift server.
         size = 30
 
         # With no Swift server, a fresh connection fails with
@@ -204,15 +200,8 @@ class TestSwiftFixture(TestCase):
             ConnectionError,
             client.get_object, "size", str(size))
 
-        # And even if we bring it back up, existing connections
-        # continue to fail
+        # If we bring it back up, the client retries and succeeds.
         self.swift_fixture.startup()
-        self.assertRaises(
-            ClientException,
-            client.get_object, "size", str(size))
-
-        # But fresh connections are fine.
-        client = self.swift_fixture.connect()
         headers, body = client.get_object("size", str(size))
         self.assertEqual(body, b"0" * size)