py3: everything account except the real things
The the 80% of the work still remain in server and replicator, but let's knock this out. Change-Id: I1e1dee8f8c77212183b0ef2b574b57ad1051d57e
This commit is contained in:
parent
ab2abfe3ae
commit
6676d74f8f
@ -270,7 +270,11 @@ class AccountReaper(Daemon):
|
||||
break
|
||||
try:
|
||||
for (container, _junk, _junk, _junk, _junk) in containers:
|
||||
this_shard = int(md5(container).hexdigest(), 16) % \
|
||||
if six.PY3:
|
||||
container_ = container.encode('utf-8')
|
||||
else:
|
||||
container_ = container
|
||||
this_shard = int(md5(container_).hexdigest(), 16) % \
|
||||
len(nodes)
|
||||
if container_shard not in (this_shard, None):
|
||||
continue
|
||||
@ -393,10 +397,11 @@ class AccountReaper(Daemon):
|
||||
self.logger.error('ERROR: invalid storage policy index: %r'
|
||||
% policy_index)
|
||||
for obj in objects:
|
||||
if isinstance(obj['name'], six.text_type):
|
||||
obj['name'] = obj['name'].encode('utf8')
|
||||
obj_name = obj['name']
|
||||
if isinstance(obj_name, six.text_type):
|
||||
obj_name = obj_name.encode('utf8')
|
||||
pool.spawn(self.reap_object, account, container, part,
|
||||
nodes, obj['name'], policy_index)
|
||||
nodes, obj_name, policy_index)
|
||||
pool.waitall()
|
||||
except (Exception, Timeout):
|
||||
self.logger.exception(_('Exception with objects for container '
|
||||
|
@ -841,12 +841,10 @@ class TestReaper(unittest.TestCase):
|
||||
r = init_reaper()
|
||||
with patch('swift.account.reaper.sleep', fake_sleep):
|
||||
with patch('swift.account.reaper.random.random', fake_random):
|
||||
try:
|
||||
with self.assertRaises(Exception) as raised:
|
||||
r.run_forever()
|
||||
except Exception as err:
|
||||
pass
|
||||
self.assertEqual(self.val, 1)
|
||||
self.assertEqual(str(err), 'exit')
|
||||
self.assertEqual(str(raised.exception), 'exit')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
2
tox.ini
2
tox.ini
@ -29,7 +29,9 @@ setenv = VIRTUAL_ENV={envdir}
|
||||
[testenv:py35]
|
||||
commands =
|
||||
nosetests {posargs:\
|
||||
test/unit/account/test_auditor.py \
|
||||
test/unit/account/test_backend.py \
|
||||
test/unit/account/test_reaper.py \
|
||||
test/unit/account/test_utils.py \
|
||||
test/unit/cli/test_dispersion_report.py \
|
||||
test/unit/cli/test_form_signature.py \
|
||||
|
Loading…
Reference in New Issue
Block a user