]> git-server-git.apps.pok.os.sepia.ceph.com Git - radosgw-agent.git/commitdiff
add a test that verifies we don't break when state is []
authorAlfredo Deza <adeza@redhat.com>
Wed, 25 May 2016 18:31:34 +0000 (14:31 -0400)
committerAlfredo Deza <adeza@redhat.com>
Wed, 25 May 2016 18:31:34 +0000 (14:31 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
Resolves: rhbz#1336532

radosgw_agent/tests/test_worker.py

index 13be6a54d75437cbf675204baa339755f936c758..f29e8a1ca802ac82dab042d2bbc6cfe49e714c26 100644 (file)
@@ -6,7 +6,7 @@ import httpretty
 import re
 
 from radosgw_agent import worker, client
-from radosgw_agent.exceptions import HttpError, NotFound, BucketEmpty
+from radosgw_agent.exceptions import HttpError, NotFound, BucketEmpty, SyncTimedOut
 
 
 class TestSyncObject(object):
@@ -111,6 +111,13 @@ class TestSyncObject(object):
         exc_message = exc.exconly()
         assert 'state not found' in exc_message
 
+    def test_wait_for_object_state_is_empty_sync_timesout(self):
+        self.client.get_op_state = lambda *a: []
+        with patch('radosgw_agent.worker.client', self.client):
+            w = worker.DataWorker(None, None, None, self.src, None, daemon_id=1)
+            with py.test.raises(SyncTimedOut) as exc:
+                w.wait_for_object(None, None, time.time() + 1, None)
+
     def test_wait_for_object_timeout(self):
         msg = 'should not have called get_op_state'
         self.client.get_op_state = Mock(side_effect=AssertionError(msg))