コード例 #1
0
    def test_main_dont_fork(self):
        with mock.patch.object(ns_proxy, "ProxyDaemon") as daemon:
            with mock.patch("eventlet.monkey_patch") as eventlet:
                with mock.patch.object(ns_proxy, "config") as config:
                    with mock.patch.object(ns_proxy, "cfg") as cfg:
                        cfg.CONF.router_id = "router_id"
                        cfg.CONF.network_id = None
                        cfg.CONF.metadata_port = 9697
                        cfg.CONF.pid_file = "pidfile"
                        cfg.CONF.daemonize = False
                        ns_proxy.main()

                        self.assertTrue(eventlet.called)
                        self.assertTrue(config.setup_logging.called)
                        daemon.assert_has_calls(
                            [mock.call("pidfile", 9697, router_id="router_id", network_id=None), mock.call().run()]
                        )
コード例 #2
0
    def test_main_dont_fork(self):
        with mock.patch.object(ns_proxy, 'ProxyDaemon') as daemon:
            with mock.patch('eventlet.monkey_patch') as eventlet:
                with mock.patch.object(ns_proxy, 'config') as config:
                    with mock.patch.object(ns_proxy, 'cfg') as cfg:
                        cfg.CONF.router_id = 'router_id'
                        cfg.CONF.network_id = None
                        cfg.CONF.metadata_port = 9697
                        cfg.CONF.pid_file = 'pidfile'
                        cfg.CONF.daemonize = False
                        ns_proxy.main()

                        self.assertTrue(eventlet.called)
                        self.assertTrue(config.setup_logging.called)
                        daemon.assert_has_calls([
                            mock.call('pidfile', 9697, router_id='router_id',
                                      network_id=None),
                            mock.call().run()]
                        )
コード例 #3
0
    def test_main_dont_fork(self):
        with mock.patch.object(ns_proxy, 'ProxyDaemon') as daemon:
            with mock.patch('eventlet.monkey_patch') as eventlet:
                with mock.patch.object(ns_proxy, 'config') as config:
                    with mock.patch.object(ns_proxy, 'cfg') as cfg:
                        cfg.CONF.router_id = 'router_id'
                        cfg.CONF.network_id = None
                        cfg.CONF.metadata_port = 9697
                        cfg.CONF.pid_file = 'pidfile'
                        cfg.CONF.daemonize = False
                        ns_proxy.main()

                        self.assertTrue(eventlet.called)
                        self.assertTrue(config.setup_logging.called)
                        daemon.assert_has_calls([
                            mock.call('pidfile', 9697, router_id='router_id',
                                      network_id=None),
                            mock.call().run()]
                        )