コード例 #1
0
ファイル: test_api_v02.py プロジェクト: ddutta/savanna
    def setUp(self):
        self.db_fd, self.db_path = tempfile.mkstemp()
        self.maxDiff = 10000

        # override configs
        CONF.set_override('reset_db', True)
        CONF.set_override('stub_data', True)
        CONF.set_override('debug', True)
        CONF.set_override('allow_cluster_ops', True)  # stub process
        CONF.set_override('database_uri', 'sqlite:///' + self.db_path,
                          group='sqlalchemy')
        CONF.set_override('echo', False, group='sqlalchemy')

        # store functions that will be stubbed
        self._prev_auth_token = savanna.main.auth_token
        self._prev_auth_valid = savanna.main.auth_valid
        self._prev_cluster_launch = api.cluster_ops.launch_cluster
        self._prev_cluster_stop = api.cluster_ops.stop_cluster

        # stub functions
        savanna.main.auth_token = _stub_auth_token
        savanna.main.auth_valid = _stub_auth_valid
        api.cluster_ops.launch_cluster = _stub_launch_cluster
        api.cluster_ops.stop_cluster = _stub_stop_cluster

        app = make_app()

        LOG.debug('Test db path: %s', self.db_path)
        LOG.debug('Test app.config: %s', app.config)

        self.app = app.test_client()
コード例 #2
0
ファイル: savanna_api.py プロジェクト: rrader/savanna
def main():
    dev_conf = os.path.join(possible_topdir, "etc", "savanna", "savanna.conf")
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(sys.argv[1:], config_files)
    logging.setup("savanna")

    if not db_api.setup_db():
        raise RuntimeError("Failed to create database!")

    app = server.make_app()

    wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port), backlog=500), app)
コード例 #3
0
def main():
    dev_conf = os.path.join(possible_topdir, 'etc', 'savanna', 'savanna.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(sys.argv[1:], config_files)
    logging.setup("savanna")

    if not db_api.setup_db():
        raise RuntimeError('Failed to create database!')

    app = server.make_app()

    wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port), backlog=500),
                app)