Merge "Remove aggregate uuid generation on load from DB"
This commit is contained in:
@@ -609,7 +609,8 @@ class AggregateMigrationTestCase(test.TestCase):
|
||||
self.context = context.get_admin_context()
|
||||
|
||||
def test_migration(self):
|
||||
db.aggregate_create(self.context, {'name': 'foo'})
|
||||
db.aggregate_create(self.context, {'name': 'foo',
|
||||
'uuid': uuidsentinel.agg_uuid})
|
||||
main_aggregates_len = len(db.aggregate_get_all(self.context))
|
||||
match, done = aggregate_obj.migrate_aggregates(self.context, 50)
|
||||
self.assertEqual(1, main_aggregates_len)
|
||||
|
||||
@@ -75,20 +75,6 @@ class _TestAggregateObject(object):
|
||||
mock_get_api.assert_called_once_with(self.context, 123)
|
||||
mock_get.assert_called_once_with(self.context, 123)
|
||||
|
||||
@mock.patch('nova.objects.Aggregate.save')
|
||||
@mock.patch('nova.db.aggregate_get')
|
||||
def test_load_allocates_uuid(self, mock_get, mock_save):
|
||||
fake_agg = dict(fake_aggregate)
|
||||
del fake_agg['uuid']
|
||||
mock_get.return_value = fake_agg
|
||||
uuid = uuidsentinel.aggregate
|
||||
with mock.patch('oslo_utils.uuidutils.generate_uuid') as mock_g:
|
||||
mock_g.return_value = uuid
|
||||
obj = aggregate.Aggregate.get_by_id(self.context, 123)
|
||||
mock_g.assert_called_once_with()
|
||||
self.assertEqual(uuid, obj.uuid)
|
||||
mock_save.assert_called_once_with()
|
||||
|
||||
@mock.patch('nova.objects.aggregate._aggregate_get_from_db_by_uuid')
|
||||
@mock.patch('nova.db.aggregate_get_by_uuid')
|
||||
def test_get_by_uuid(self, get_by_uuid, get_by_uuid_api):
|
||||
|
||||
Reference in New Issue
Block a user