def test_cannot_start_group_without_write(environment, default_connection): node_write = inner_logic.get_node( environment.group, environment.master, default_connection ) node_write.fox_connection.query( Query.UPDATE_MODE % ('read_only', node_write.ip, node_write.group) ) assert node_write.mode != node_write.fox_mode with pytest.raises(NoWriteNodeError): inner_logic.start(environment.group, default_connection)
def test_cannot_start_with_master_node_down(environment, default_connection): node_write = inner_logic.get_node( environment.group, environment.master, default_connection ) assert node_write.is_mysql_status_up() test_utils.deactivate_node(environment.master_node) assert node_write.is_mysql_status_down() with pytest.raises(NodeIsDownError): inner_logic.start(environment.group, default_connection) test_utils.activate_node(environment.master_node)
def test_cannot_start_group_with_many_write(environment, default_connection): node_repl = inner_logic.get_node( environment.group, environment.replication, default_connection ) node_repl.fox_connection.query( Query.UPDATE_MODE % ('read_write', node_repl.ip, node_repl.group) ) assert node_repl.mode != node_repl.fox_mode with pytest.raises(ManyWriteNodesError): inner_logic.start(environment.group, default_connection) node_repl.fox_connection.query( Query.UPDATE_MODE % ('read_only', node_repl.ip, node_repl.group) ) assert node_repl.mode == node_repl.fox_mode
def test_can_start_group(environment, default_connection): node_write = inner_logic.get_node( environment.group, environment.master, default_connection ) node_write.node_connection.query(Query.SET_MODE % 'ON') assert node_write.mode != node_write.fox_mode assert inner_logic.start(environment.group, default_connection) assert node_write.mode == node_write.fox_mode
def start(self, group_name): LOG.info("Start group: {}".format(group_name)) return inner_logic.start(group_name, self.fox_connection)