Merge "Corrected a number of style violations in the tests."

This commit is contained in:
Jenkins
2013-07-23 17:06:06 +00:00
committed by Gerrit Code Review

View File

@@ -112,7 +112,7 @@ def _create_test_ring(path):
[0, 1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 5, 6],
[1, 2, 3, 0, 5, 6, 4], [1, 2, 3, 0, 5, 6, 4],
[2, 3, 0, 1, 6, 4, 5], [2, 3, 0, 1, 6, 4, 5],
] ]
intended_devs = [ intended_devs = [
{'id': 0, 'device': 'sda', 'zone': 0, 'ip': '127.0.0.0', 'port': 6000}, {'id': 0, 'device': 'sda', 'zone': 0, 'ip': '127.0.0.0', 'port': 6000},
{'id': 1, 'device': 'sda', 'zone': 1, 'ip': '127.0.0.1', 'port': 6000}, {'id': 1, 'device': 'sda', 'zone': 1, 'ip': '127.0.0.1', 'port': 6000},
@@ -160,7 +160,6 @@ class TestObjectReplicator(unittest.TestCase):
self.replicator.logger = FakeLogger() self.replicator.logger = FakeLogger()
def tearDown(self): def tearDown(self):
process_errors = []
rmtree(self.testdir, ignore_errors=1) rmtree(self.testdir, ignore_errors=1)
def test_run_once(self): def test_run_once(self):
@@ -183,7 +182,7 @@ class TestObjectReplicator(unittest.TestCase):
whole_path_from = os.path.join(self.objects, cur_part, data_dir) whole_path_from = os.path.join(self.objects, cur_part, data_dir)
process_arg_checker = [] process_arg_checker = []
nodes = [node for node in nodes = [node for node in
self.ring.get_part_nodes(int(cur_part)) \ self.ring.get_part_nodes(int(cur_part))
if node['ip'] not in _ips()] if node['ip'] not in _ips()]
for node in nodes: for node in nodes:
rsync_mod = '%s::object/sda/objects/%s' % (node['ip'], cur_part) rsync_mod = '%s::object/sda/objects/%s' % (node['ip'], cur_part)
@@ -332,7 +331,7 @@ class TestObjectReplicator(unittest.TestCase):
whole_path_from = os.path.join(self.objects, cur_part, data_dir) whole_path_from = os.path.join(self.objects, cur_part, data_dir)
process_arg_checker = [] process_arg_checker = []
nodes = [node for node in nodes = [node for node in
self.ring.get_part_nodes(int(cur_part)) \ self.ring.get_part_nodes(int(cur_part))
if node['ip'] not in _ips()] if node['ip'] not in _ips()]
for node in nodes: for node in nodes:
rsync_mod = '%s::object/sda/objects/%s' % (node['ip'], rsync_mod = '%s::object/sda/objects/%s' % (node['ip'],
@@ -396,7 +395,7 @@ class TestObjectReplicator(unittest.TestCase):
whole_path_from = os.path.join(self.objects, cur_part, data_dir) whole_path_from = os.path.join(self.objects, cur_part, data_dir)
process_arg_checker = [] process_arg_checker = []
nodes = [node for node in nodes = [node for node in
self.ring.get_part_nodes(int(cur_part)) \ self.ring.get_part_nodes(int(cur_part))
if node['ip'] not in _ips()] if node['ip'] not in _ips()]
for node in nodes: for node in nodes:
rsync_mod = '%s::object/sda/objects/%s' % (node['ip'], rsync_mod = '%s::object/sda/objects/%s' % (node['ip'],
@@ -517,7 +516,7 @@ class TestObjectReplicator(unittest.TestCase):
self.replicator.update(local_job) self.replicator.update(local_job)
reqs = [] reqs = []
for node in local_job['nodes']: for node in local_job['nodes']:
reqs.append(mock.call(node, local_job, ['a83'])) reqs.append(mock.call(node, local_job, ['a83']))
fake_func.assert_has_calls(reqs, any_order=True) fake_func.assert_has_calls(reqs, any_order=True)
self.assertEquals(fake_func.call_count, 2) self.assertEquals(fake_func.call_count, 2)
self.assertEquals(self.replicator.replication_count, 1) self.assertEquals(self.replicator.replication_count, 1)
@@ -530,8 +529,8 @@ class TestObjectReplicator(unittest.TestCase):
# test for replication params # test for replication params
repl_job = local_job.copy() repl_job = local_job.copy()
for node in repl_job['nodes']: for node in repl_job['nodes']:
node['replication_ip'] = '127.0.0.11' node['replication_ip'] = '127.0.0.11'
node['replication_port'] = '6011' node['replication_port'] = '6011'
set_default(self) set_default(self)
self.replicator.update(repl_job) self.replicator.update(repl_job)
reqs = [] reqs = []