def fake_node(tdir, tconf): node = FakeNode(tdir, config=tconf) node.unpackClientMsg = functools.partial(Node.unpackClientMsg, node) node.is_request_need_quorum = functools.partial(Node.is_request_need_quorum, node) node.view_changer.view_change_in_progress = True fake_node.postToClientInBox = lambda a, b: None return node
def fake_node(tdir, tconf, request): node = FakeNode(tdir, config=tconf) node.msgHasAcceptableViewNo = Node.msgHasAcceptableViewNo node._is_initial_view_change_now = functools.partial(Node._is_initial_view_change_now, node) node.msgsForFutureViews = {} node.msgsToViewChanger = deque() node.view_changer.view_no = request.param node.view_changer.last_completed_view_no = request.param node.view_changer.pre_vc_strategy = None return node
def fake_node(tdir, tconf): node = FakeNode(tdir, config=tconf) node.isParticipating = True replica = node.replicas[0] state_root = "EuDgqga9DNr4bjH57Rdq6BRtvCN1PV9UX5Mpnm9gbMAZ" replica.node.isParticipating = True replica.stateRootHash = lambda ledger, to_str=False: state_root replica._apply_pre_prepare = lambda a, b: None replica.primaryNames[replica.viewNo] = replica.primaryName replica._gc = lambda args: None replica.primaryName = "Alpha:0" return node
def backup_instance_faulty_processor(tdir, tconf): node = FakeNode(tdir, config=tconf) node.view_change_in_progress = False node.requiredNumberOfInstances = len(node.replicas) node.allNodeNames = [ "Node{}".format(i) for i in range(1, (node.requiredNumberOfInstances - 1) * 3 + 2) ] node.totalNodes = len(node.allNodeNames) node.quorums = Quorums(node.totalNodes) node.name = node.allNodeNames[0] node.replicas = FakeReplicas(node, node.replicas) node.backup_instance_faulty_processor = BackupInstanceFaultyProcessor(node) return node.backup_instance_faulty_processor
def backup_instance_faulty_processor(tdir, tconf): node = FakeNode(tdir, config=tconf) node.view_change_in_progress = False node.requiredNumberOfInstances = len(node.replicas) node.allNodeNames = ["Node{}".format(i) for i in range(1, (node.requiredNumberOfInstances - 1) * 3 + 2)] node.totalNodes = len(node.allNodeNames) node.quorums = Quorums(node.totalNodes) node.name = node.allNodeNames[0] node.replicas = FakeReplicas(node, node.replicas) node.backup_instance_faulty_processor = BackupInstanceFaultyProcessor(node) return node.backup_instance_faulty_processor
def test_quorum_collection(tdir): node = FakeNode(tdir) proc = BackupInstanceFaultyProcessor(node) backup_faulty = BackupInstanceFaulty( 0, [1], Suspicions.BACKUP_PRIMARY_DEGRADED.code) proc.process_backup_instance_faulty_msg(backup_faulty, 'someone') assert len(proc.backup_instances_faulty[1].keys()) == 1
def fake_node(tdir, tconf, request): node = FakeNode(tdir, config=tconf) node.msgHasAcceptableViewNo = Node.msgHasAcceptableViewNo node._is_initial_view_change_now = functools.partial( Node._is_initial_view_change_now, node) node.msgsForFutureViews = {} node.msgsToViewChanger = deque() node.set_view_for_replicas = lambda a: None node.view_changer.view_no = request.param node.view_changer.last_completed_view_no = request.param node.view_changer.pre_vc_strategy = None return node
def fake_node(tdir, tconf, request): node = FakeNode(tdir, config=tconf) node.msgHasAcceptableViewNo = Node.msgHasAcceptableViewNo node._is_initial_propagate_primary = functools.partial( Node._is_initial_propagate_primary, node) node.msgsForFutureViews = {} node.msgsToViewChanger = deque() node.view_changer.view_no = request.param node.view_changer.last_completed_view_no = request.param return node