Esempio n. 1
0
    def setUp(self, inline_host_acquisition=True, setup_tables=True):
        """Common setup module for tests that need a jobs/host database.

        @param inline_host_acquisition: If True, the dispatcher tries to acquire
            hosts inline with the rest of the tick.
        """
        self.db_helper = DBHelper()
        self._database = self.db_helper.database
        # Runs syncdb setting up initial database conditions
        self._frontend_common_setup(setup_tables=setup_tables)
        connection_manager = scheduler_lib.ConnectionManager(autocommit=False)
        self.god.stub_with(connection_manager, 'db_connection', self._database)
        self.god.stub_with(monitor_db, '_db_manager', connection_manager)
        self.god.stub_with(scheduler_models, '_db', self._database)
        self.god.stub_with(monitor_db, '_inline_host_acquisition',
                           inline_host_acquisition)
        self._dispatcher = monitor_db.Dispatcher()
        self.host_scheduler = self._dispatcher._host_scheduler
        self.host_query_manager = query_managers.AFEHostQueryManager()
        self.job_query_manager = self._dispatcher._job_query_manager
        self._release_unused_hosts()
 def _create_dispatcher(self):
     self.dispatcher = monitor_db.Dispatcher()
 def setUp(self):
     self._frontend_common_setup()
     self._set_monitor_stubs()
     self._set_global_config_values()
     self._dispatcher = monitor_db.Dispatcher()
Esempio n. 4
0
 def setUp(self):
     self._frontend_common_setup()
     self._set_monitor_stubs()
     self._dispatcher = monitor_db.Dispatcher()