예제 #1
0
 def _row(self, session=None):
     """Get a row from the database with self.uuid and self.version_id"""
     try:
         # race condition if version_id changed outside of this node_info
         return db.model_query(db.Node, session=session).filter_by(
             uuid=self.uuid, version_id=self.version_id).one()
     except (orm_errors.NoResultFound, orm_errors.StaleDataError):
         raise utils.NodeStateRaceCondition(node_info=self)
예제 #2
0
 def test_node_in_db_race_condition(self, fsm_event_mock, add_node_mock):
     fsm_event_mock.side_effect = utils.NodeStateRaceCondition()
     six.assertRaisesRegex(self, utils.NodeStateRaceCondition, '.*',
                           node_cache.start_introspection,
                           self.node_info.uuid)
     self.assertFalse(add_node_mock.called)