def init_host(self, service_id, **kwargs): ctxt = context.get_admin_context() self.service_id = service_id # TODO(geguileo): Once we don't support MySQL 5.5 anymore we can remove # call to workers_init. db.workers_init() cleanup_request = objects.CleanupRequest(service_id=service_id) self.do_cleanup(ctxt, cleanup_request)
def test_workers_init_not_supported(self): # Fake a Db that doesn't support sub-second resolution in datetimes db.worker_update( self.ctxt, None, {'resource_type': 'SENTINEL', 'ignore_sentinel': False}, updated_at=datetime.utcnow().replace(microsecond=0)) db.workers_init() self.assertFalse(db.sqlalchemy.api.DB_SUPPORTS_SUBSECOND_RESOLUTION)
def test_workers_init_not_supported(self): # Fake a Db that doesn't support sub-second resolution in datetimes db.worker_update(self.ctxt, None, { 'resource_type': 'SENTINEL', 'ignore_sentinel': False }, updated_at=datetime.utcnow().replace(microsecond=0)) db.workers_init() self.assertFalse(db.sqlalchemy.api.DB_SUPPORTS_SUBSECOND_RESOLUTION)
def test_workers_init(self): # SQLite supports subsecond resolution so result is True db.sqlalchemy.api.DB_SUPPORTS_SUBSECOND_RESOLUTION = None db.workers_init() self.assertTrue(db.sqlalchemy.api.DB_SUPPORTS_SUBSECOND_RESOLUTION)