def _request_view_change_message(self, key):
     self._bus.send(
         MissingMessage(msg_type=VIEW_CHANGE,
                        key=key,
                        inst_id=self._data.inst_id,
                        dst=None,
                        stash_data=None))
Exemple #2
0
 def _request_new_view_message(self, view_no):
     self._bus.send(
         MissingMessage(msg_type=NEW_VIEW,
                        key=view_no,
                        inst_id=self._data.inst_id,
                        dst=None,
                        stash_data=None))
 def _request_new_view_message(self, view_no):
     self._bus.send(
         MissingMessage(msg_type=NEW_VIEW,
                        key=view_no,
                        inst_id=self._data.inst_id,
                        dst=[getNodeName(self._data.primary_name)],
                        stash_data=None))
def test_process_missing_message_incorrect_inst_id(
        message_req_service: MessageReqService, external_bus, data):
    frm = "frm"
    missing_msg = MissingMessage(msg_type=PREPREPARE,
                                 key=data.last_ordered_3pc,
                                 inst_id=data.inst_id + 1,
                                 dst=[frm],
                                 stash_data=None)
    message_req_service.process_missing_message(missing_msg)
    assert len(external_bus.sent_messages) == 0
def test_process_missing_message_raise_ex(
        message_req_service: MessageReqService, external_bus, data):
    frm = "frm"
    msg_type = PREPREPARE
    missing_msg = MissingMessage(msg_type=msg_type,
                                 key=data.last_ordered_3pc,
                                 inst_id=data.inst_id + 1,
                                 dst=[frm],
                                 stash_data=None)
    message_req_service.handlers[
        msg_type].prepare_msg_to_request = lambda msg: raise_ex()
    message_req_service.process_missing_message(missing_msg)
    assert len(external_bus.sent_messages) == 0
def test_process_missing_message_new_view(message_req_service: MessageReqService, external_bus, data,
                                          internal_bus, new_view_message: NewView):
    primary = data.primary_name
    inst_id = data.inst_id
    missing_msg = MissingMessage(msg_type=NEW_VIEW,
                                 key=data.view_no,
                                 inst_id=inst_id,
                                 dst=[primary],
                                 stash_data=None)
    internal_bus.send(missing_msg)
    assert len(external_bus.sent_messages) == 1
    assert external_bus.sent_messages[0] == (MessageReq(NEW_VIEW,
                                                        {f.INST_ID.nm: inst_id,
                                                         f.VIEW_NO.nm: data.view_no}),
                                             [primary])
Exemple #7
0
def test_process_missing_message_commit(message_req_service: MessageReqService, external_bus, data):
    frm = "frm"
    view_no = data.view_no
    pp_seq_no = data.last_ordered_3pc[1] + 1
    missing_msg = MissingMessage(msg_type=COMMIT,
                                    key=(view_no, pp_seq_no),
                                    inst_id=data.inst_id,
                                    dst=[frm],
                                    stash_data=None)
    message_req_service.process_missing_message(missing_msg)
    assert len(external_bus.sent_messages) == 1
    assert external_bus.sent_messages[0] == (MessageReq(COMMIT,
                                                        {f.INST_ID.nm: data.inst_id,
                                                         f.VIEW_NO.nm: view_no,
                                                         f.PP_SEQ_NO.nm: pp_seq_no}),
                                             [frm])
def test_process_missing_message_view_change(message_req_service: MessageReqService, external_bus, data,
                                             internal_bus, view_change_message: ViewChange):
    frm = "frm"
    confused_node = "confused_node"
    inst_id = data.inst_id
    digest = view_change_digest(view_change_message)
    missing_msg = MissingMessage(msg_type=VIEW_CHANGE,
                                 key=(frm, digest),
                                 inst_id=inst_id,
                                 dst=[confused_node],
                                 stash_data=None)
    internal_bus.send(missing_msg)
    assert len(external_bus.sent_messages) == 1
    assert external_bus.sent_messages[0] == (MessageReq(VIEW_CHANGE,
                                                        {f.INST_ID.nm: inst_id,
                                                         f.DIGEST.nm: digest,
                                                         f.NAME.nm: frm}),
                                             [confused_node])