Esempio n. 1
0
 def test_fix_node_importing(self, migrate_slot):
     cluster = self.cluster
     a = cluster.nodes[0]
     b = cluster.nodes[1]
     c = cluster.nodes[2]
     for n in cluster.nodes:
         n.node_info  # gen node_info
     a._cached_node_info['importing'] = {
         '233': b.name,
         '666': c.name,
         '99': 'name_not_in_cluster',
     }
     b._cached_node_info['migrating'] = {'233': a.name}
     cluster.fix_node(a)
     self.assert_no_exec(a, 'CLUSTER SETSLOT', '233', 'STABLE')
     self.assert_no_exec(b, 'CLUSTER SETSLOT', '233', 'STABLE')
     self.assert_exec_cmd(a, 'CLUSTER SETSLOT', '666', 'STABLE')
     self.assert_exec_cmd(a, 'CLUSTER SETSLOT', '99', 'STABLE')
     migrate_slot.assert_called_with(b, a, '233')
     self.assert_not_called_with(migrate_slot, c, a, '666')
Esempio n. 2
0
 def test_fix_node_importing(self, migrate_slot):
     cluster = self.cluster
     a = cluster.nodes[0]
     b = cluster.nodes[1]
     c = cluster.nodes[2]
     for n in cluster.nodes:
         n.node_info  # gen node_info
     a._cached_node_info['importing'] = {
         '233': b.name,
         '666': c.name,
         '99': 'name_not_in_cluster',
     }
     b._cached_node_info['migrating'] = {'233': a.name}
     cluster.fix_node(a)
     self.assert_no_exec(a, 'CLUSTER SETSLOT', '233', 'STABLE')
     self.assert_no_exec(b, 'CLUSTER SETSLOT', '233', 'STABLE')
     self.assert_exec_cmd(a, 'CLUSTER SETSLOT', '666', 'STABLE')
     self.assert_exec_cmd(a, 'CLUSTER SETSLOT', '99', 'STABLE')
     migrate_slot.assert_called_with(b, a, '233')
     self.assert_not_called_with(migrate_slot, c, a, '666')