import re
from radosgw_agent import worker, client
-from radosgw_agent.exceptions import HttpError, NotFound, BucketEmpty, SyncTimedOut
+from radosgw_agent.exceptions import HttpError, NotModified, NotFound, BucketEmpty, SyncTimedOut
class TestSyncObject(object):
w = worker.DataWorker(None, None, None, self.src, None, daemon_id=1)
assert w.sync_object('mah-bucket', self.obj) is True
+ def test_syncs_correctly_on_not_modified(self):
+ self.client.sync_object_intra_region = Mock(side_effect=NotModified(304, ''))
+
+ with patch('radosgw_agent.worker.client'):
+ w = worker.DataWorker(None, None, None, self.src, None, daemon_id=1)
+ assert w.sync_object('mah-bucket', self.obj) is True
+
def test_syncs_not_found_on_master_deleting_from_secondary(self):
self.client.sync_object_intra_region = Mock(side_effect=NotFound(404, ''))
from radosgw_agent import client
from radosgw_agent import lock
from radosgw_agent.util import obj as obj_, get_dev_logger
-from radosgw_agent.exceptions import SkipShard, SyncError, SyncTimedOut, SyncFailed, NotFound, BucketEmpty
+from radosgw_agent.exceptions import SkipShard, SyncError, SyncTimedOut, SyncFailed, NotModified, NotFound, BucketEmpty
from radosgw_agent.constants import DEFAULT_TIME, RESULT_SUCCESS, RESULT_ERROR
log = logging.getLogger(__name__)
self.daemon_id,
local_op_id)
found = True
+ except NotModified:
+ log.debug('object "%s/%s" found on master and not modified',
+ bucket, obj.name)
+ found = True
except NotFound:
log.debug('object "%s/%s" not found on master, deleting from secondary',
bucket, obj.name)