Пример #1
0
    def test_rpc_endpoints(self):
        self.mdns = mdns.Service()

        endpoints = self.mdns._rpc_endpoints

        self.assertIsInstance(endpoints[0], mdns.notify.NotifyEndpoint)
        self.assertIsInstance(endpoints[1], mdns.xfr.XfrEndpoint)
Пример #2
0
def main():
    utils.read_config('designate', sys.argv)
    logging.setup(CONF, 'designate')
    utils.setup_gmr(log_dir=cfg.CONF.log_dir)

    server = mdns_service.Service()
    service.serve(server, workers=CONF['service:mdns'].workers)
    service.wait()
Пример #3
0
    def setUp(self, *mocks):
        super(MdnsServiceTest, self).setUp()
        mdns.CONF = RoObject({'service:mdns': RoObject(storage_driver=None)})
        # _rpc_endpoints is a property
        mock_rpc_endpoints = mocks[0]
        mock_rpc_endpoints.__get__ = mock.Mock(
            return_value=[mock.MagicMock(), mock.MagicMock()])

        self.mdns = mdns.Service()
        self.mdns.tg = mock.Mock(name='tg')
Пример #4
0
    def test_storage_driver(self, mock_get_driver):
        mock_driver = mock.MagicMock()
        mock_driver.name = 'noop_driver'
        mock_get_driver.return_value = mock_driver

        self.mdns = mdns.Service()

        self.assertIsInstance(self.mdns.storage, mock.MagicMock)

        self.assertTrue(mock_get_driver.called)
Пример #5
0
def main():
    utils.read_config('designate', sys.argv)
    logging.setup(CONF, 'designate')
    gmr.TextGuruMeditation.setup_autorun(version)

    hookpoints.log_hook_setup()

    server = mdns_service.Service(threads=CONF['service:mdns'].threads)
    service.serve(server, workers=CONF['service:mdns'].workers)
    server.heartbeat_emitter.start()
    service.wait()
Пример #6
0
    def test_dns_application(self, mock_req_handler, mock_cache_result,
                             mock_service_start, mock_get_driver):
        mock_driver = mock.MagicMock()
        mock_driver.name = 'noop_driver'
        mock_get_driver.return_value = mock_driver

        self.mdns = mdns.Service()

        app = self.mdns._dns_application

        self.assertIsInstance(app, mdns.dnsutils.DNSMiddleware)
Пример #7
0
    def test_service_name(self):
        self.mdns = mdns.Service()

        self.assertEqual('mdns', self.mdns.service_name)
Пример #8
0
    def test_service_start(self, mock_service_start, mock_rpc_server):
        self.mdns = mdns.Service()
        self.mdns.start()

        self.assertTrue(mock_service_start.called)
        self.assertTrue(mock_rpc_server.called)