5011: Fix unreliable test.
authorTom Clegg <tom@curoverse.com>
Fri, 13 Feb 2015 00:04:01 +0000 (19:04 -0500)
committerTom Clegg <tom@curoverse.com>
Fri, 13 Feb 2015 17:39:46 +0000 (12:39 -0500)
The collection writer was (sometimes) consuming the last 200 response
even though it could write 3 copies without it. This shouldn't fail
the test: the only reason we count the PUT calls is to verify all
three of the 200 responses were consumed (i.e., none of the 500
responses were counted toward the achieved replication level). To
verify this without being sensitive to extra requests, we simply
arrange for the three 200 responses to be the last ones available.

sdk/python/tests/test_collections.py

index 4ca8dfef9e98fc941abbbe96e4335a6eb865a232..dbbe3f5e73deca582b65f42900f8181e52a63a02 100644 (file)
@@ -720,10 +720,10 @@ class CollectionWriterTestCase(unittest.TestCase, CollectionTestMixin):
         self.mock_keep_services(client, status=200, service_type='disk', count=6)
         writer = self.foo_writer(api_client=client, replication=3)
         with self.mock_keep(
-                None, 200, 500, 200, 500, 200, 200,
+                None, 500, 500, 500, 200, 200, 200,
                 **{'x-keep-replicas-stored': 1}) as keepmock:
             writer.manifest_text()
-            self.assertEqual(5, keepmock.call_count)
+            self.assertEqual(6, keepmock.call_count)
 
     def test_write_whole_collection_through_retries(self):
         writer = self.foo_writer(num_retries=2)