From beec71f2d23a29322d1c5d7e6d4802004d72d050 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Wed, 25 May 2016 14:31:34 -0400 Subject: [PATCH] add a test that verifies we don't break when state is [] Signed-off-by: Alfredo Deza Resolves: rhbz#1336532 --- radosgw_agent/tests/test_worker.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/radosgw_agent/tests/test_worker.py b/radosgw_agent/tests/test_worker.py index 13be6a5..f29e8a1 100644 --- a/radosgw_agent/tests/test_worker.py +++ b/radosgw_agent/tests/test_worker.py @@ -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)) -- 2.47.3