Beispiel #1
0
def hm_listener(exit_event):
    # TODO(german): stevedore load those drivers
    signal.signal(signal.SIGINT, signal.SIG_IGN)
    udp_getter = heartbeat_udp.UDPStatusGetter(update_db.UpdateHealthDb(),
                                               update_db.UpdateStatsDb())
    while not exit_event.is_set():
        udp_getter.check()
    def setUp(self):
        super(TestUpdateHealthDb, self).setUp()

        conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
        conf.config(group="health_manager",
                    event_streamer_driver='queue_event_streamer')

        session_patch = mock.patch('octavia.db.api.get_session')
        self.addCleanup(session_patch.stop)
        self.mock_session = session_patch.start()

        self.hm = update_db.UpdateHealthDb()
        self.event_client = mock.MagicMock()
        self.hm.event_streamer.client = self.event_client
        self.amphora_repo = mock.MagicMock()
        self.amphora_health_repo = mock.MagicMock()
        self.listener_repo = mock.MagicMock()
        self.loadbalancer_repo = mock.MagicMock()
        self.member_repo = mock.MagicMock()
        self.pool_repo = mock.MagicMock()

        self.hm.amphora_repo = self.amphora_repo
        fake_lb = mock.MagicMock()
        self.hm.amphora_repo.get_all_lbs_on_amphora.return_value = [fake_lb]
        self.hm.amphora_health_repo = self.amphora_health_repo
        self.hm.listener_repo = self.listener_repo
        self.hm.listener_repo.count.return_value = 1
        self.hm.loadbalancer_repo = self.loadbalancer_repo
        self.hm.member_repo = self.member_repo
        self.hm.pool_repo = self.pool_repo
def hm_listener():
    # TODO(german): steved'or load those drivers
    udp_getter = heartbeat_udp.UDPStatusGetter(
        update_db.UpdateHealthDb(),
        update_db.UpdateStatsDb())
    while True:
        udp_getter.check()
Beispiel #4
0
    def setUp(self):
        super(TestUpdateHealthDb, self).setUp()
        cfg.CONF.set_override(group='health_manager',
                              name='event_streamer_driver',
                              override='queue_event_streamer')
        self.hm = update_db.UpdateHealthDb()
        self.event_client = mock.MagicMock()
        self.hm.event_streamer.client = self.event_client
        self.amphora_repo = mock.MagicMock()
        self.amphora_health_repo = mock.MagicMock()
        self.listener_repo = mock.MagicMock()
        self.loadbalancer_repo = mock.MagicMock()
        self.member_repo = mock.MagicMock()
        self.pool_repo = mock.MagicMock()

        self.hm.amphora_repo = self.amphora_repo
        fake_lb = mock.MagicMock()
        self.hm.amphora_repo.get_all_lbs_on_amphora.return_value = [fake_lb]
        self.hm.amphora_health_repo = self.amphora_health_repo
        self.hm.listener_repo = self.listener_repo
        self.hm.listener_repo.count.return_value = 1
        self.hm.loadbalancer_repo = self.loadbalancer_repo
        self.hm.member_repo = self.member_repo
        self.hm.pool_repo = self.pool_repo