[ARVADOS] updated: d5809a1e62e1b1a3984fff88118e036b1f174ff1

git at public.curoverse.com git at public.curoverse.com
Fri Feb 13 12:44:20 EST 2015


Summary of changes:
 sdk/python/tests/arvados_testutil.py | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

  discards  3068c6202ba52547f4a5f8c685f47a65e695633d (commit)
  discards  aad2a35331e1290d4ba493d9a537a498474caba7 (commit)
       via  d5809a1e62e1b1a3984fff88118e036b1f174ff1 (commit)
       via  50df4956c5b0e93efd781fbb070d9d5d30d39eda (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (3068c6202ba52547f4a5f8c685f47a65e695633d)
            \
             N -- N -- N (d5809a1e62e1b1a3984fff88118e036b1f174ff1)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit d5809a1e62e1b1a3984fff88118e036b1f174ff1
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Feb 12 19:04:01 2015 -0500

    5011: Fix unreliable test.
    
    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.

diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index 4ca8dfe..dbbe3f5 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -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)

commit 50df4956c5b0e93efd781fbb070d9d5d30d39eda
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Feb 12 18:56:02 2015 -0500

    5011: Use a threadsafe wrapper to feed side effects to mocks.

diff --git a/sdk/python/tests/arvados_testutil.py b/sdk/python/tests/arvados_testutil.py
index 124fb35..378e93f 100644
--- a/sdk/python/tests/arvados_testutil.py
+++ b/sdk/python/tests/arvados_testutil.py
@@ -8,6 +8,7 @@ import httplib2
 import io
 import mock
 import os
+import Queue
 import requests
 import shutil
 import tempfile
@@ -19,6 +20,18 @@ TEST_HOST = '100::'
 
 skip_sleep = mock.patch('time.sleep', lambda n: None)  # clown'll eat me
 
+def queue_with(items):
+    """Return a thread-safe iterator that yields the given items.
+
+    +items+ can be given as an array or an iterator. If an iterator is
+    given, it will be consumed to fill the queue before queue_with()
+    returns.
+    """
+    queue = Queue.Queue()
+    for val in items:
+        queue.put(val)
+    return lambda *args, **kwargs: queue.get(block=False)
+
 # fake_httplib2_response and mock_responses
 # mock calls to httplib2.Http.request()
 def fake_httplib2_response(code, **headers):
@@ -27,8 +40,8 @@ def fake_httplib2_response(code, **headers):
     return httplib2.Response(headers)
 
 def mock_responses(body, *codes, **headers):
-    return mock.patch('httplib2.Http.request', side_effect=(
-            (fake_httplib2_response(code, **headers), body) for code in codes))
+    return mock.patch('httplib2.Http.request', side_effect=queue_with((
+        (fake_httplib2_response(code, **headers), body) for code in codes)))
 
 # fake_requests_response, mock_get_responses and mock_put_responses
 # mock calls to requests.get() and requests.put()
@@ -41,16 +54,16 @@ def fake_requests_response(code, body, **headers):
     return r
 
 def mock_get_responses(body, *codes, **headers):
-    return mock.patch('requests.get', side_effect=(
-        fake_requests_response(code, body, **headers) for code in codes))
+    return mock.patch('requests.get', side_effect=queue_with((
+        fake_requests_response(code, body, **headers) for code in codes)))
 
 def mock_put_responses(body, *codes, **headers):
-    return mock.patch('requests.put', side_effect=(
-        fake_requests_response(code, body, **headers) for code in codes))
+    return mock.patch('requests.put', side_effect=queue_with((
+        fake_requests_response(code, body, **headers) for code in codes)))
 
 def mock_requestslib_responses(method, body, *codes, **headers):
-    return mock.patch(method, side_effect=(
-        fake_requests_response(code, body, **headers) for code in codes))
+    return mock.patch(method, side_effect=queue_with((
+        fake_requests_response(code, body, **headers) for code in codes)))
 
 class MockStreamReader(object):
     def __init__(self, name='.', *data):

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list