def test_receive_poison_A_C_D_E_and_F_dont_make_blocked(
        message_a, message_c, message_d, message_e, message_f):
    blocking_detector = BlockingDetector()
    blocking_detector.notify_poison_received(message_a)
    blocking_detector.notify_poison_received(message_c)
    blocking_detector.notify_poison_received(message_d)
    blocking_detector.notify_poison_received(message_e)
    blocking_detector.notify_poison_received(message_f)
    assert not blocking_detector.is_blocked()
def test_receive_poison_A_B_D_E_F_and_G_dont_make_blocked(
        message_a, message_b, message_d, message_e, message_f, message_g):
    blocking_detector = BlockingDetector()
    blocking_detector.notify_poison_received(message_a)
    blocking_detector.notify_poison_received(message_b)
    blocking_detector.notify_poison_received(message_d)
    blocking_detector.notify_poison_received(message_e)
    blocking_detector.notify_poison_received(message_f)
    blocking_detector.notify_poison_received(message_g)
    assert not blocking_detector.is_blocked()
def test_receive_poison_A_B_and_D_dont_make_blocked(message_a, message_b,
                                                    message_d):
    blocking_detector = BlockingDetector()
    blocking_detector.notify_poison_received(message_a)
    blocking_detector.notify_poison_received(message_b)
    blocking_detector.notify_poison_received(message_d)
    assert not blocking_detector.is_blocked()
Example #4
0
 def receiveMsg_OKMessage(self, message: OKMessage, sender: ActorAddress):
     """
     When receiving OKMessage after trying to start a formula, move formula from the waiting service to the formula pool
     """
     formula_name = message.sender_name
     waiting_messages = self.formula_waiting_service.get_waiting_messages(
         formula_name)
     self.formula_waiting_service.remove_formula(formula_name)
     self.formula_pool[formula_name] = (sender, BlockingDetector())
     for waiting_msg in waiting_messages:
         self._send_message(formula_name, waiting_msg)
     self.log_info('formula ' + formula_name + 'started')
def test_receive_poison_A_B_and_C_with_B_sup_to_max_id_make_blocked(
        message_a, message_b, message_c):
    message_a.dispatcher_report_id = 10000
    message_b.dispatcher_report_id = 0
    message_c.dispatcher_report_id = 1
    blocking_detector = BlockingDetector()
    blocking_detector.notify_poison_received(message_a)
    blocking_detector.notify_poison_received(message_b)
    blocking_detector.notify_poison_received(message_c)
    assert blocking_detector.is_blocked()