Merge "Clean up read_deleted support in host aggregates code"
This commit is contained in:
@@ -3286,8 +3286,8 @@ class ComputeAPIAggrTestCase(test.TestCase):
|
|||||||
aggr = self.api.create_aggregate(self.context, 'fake_aggregate',
|
aggr = self.api.create_aggregate(self.context, 'fake_aggregate',
|
||||||
'fake_zone')
|
'fake_zone')
|
||||||
self.api.delete_aggregate(self.context, aggr['id'])
|
self.api.delete_aggregate(self.context, aggr['id'])
|
||||||
expected = db.aggregate_get(self.context, aggr['id'],
|
expected = db.aggregate_get(self.context.elevated(read_deleted='yes'),
|
||||||
read_deleted='yes')
|
aggr['id'])
|
||||||
self.assertNotEqual(aggr['operational_state'],
|
self.assertNotEqual(aggr['operational_state'],
|
||||||
expected['operational_state'])
|
expected['operational_state'])
|
||||||
|
|
||||||
|
|||||||
@@ -503,11 +503,10 @@ class AggregateDBApiTestCase(test.TestCase):
|
|||||||
ctxt = context.get_admin_context()
|
ctxt = context.get_admin_context()
|
||||||
result = _create_aggregate(context=ctxt, metadata=None)
|
result = _create_aggregate(context=ctxt, metadata=None)
|
||||||
db.aggregate_delete(ctxt, result['id'])
|
db.aggregate_delete(ctxt, result['id'])
|
||||||
expected = db.aggregate_get_all(ctxt, read_deleted='no')
|
expected = db.aggregate_get_all(ctxt)
|
||||||
self.assertEqual(0, len(expected))
|
self.assertEqual(0, len(expected))
|
||||||
|
aggregate = db.aggregate_get(ctxt.elevated(read_deleted='yes'),
|
||||||
ctxt = context.get_admin_context(read_deleted='yes')
|
result['id'])
|
||||||
aggregate = db.aggregate_get(ctxt, result['id'])
|
|
||||||
self.assertEqual(aggregate["operational_state"], "dismissed")
|
self.assertEqual(aggregate["operational_state"], "dismissed")
|
||||||
|
|
||||||
def test_aggregate_update(self):
|
def test_aggregate_update(self):
|
||||||
@@ -575,7 +574,7 @@ class AggregateDBApiTestCase(test.TestCase):
|
|||||||
values=values, metadata=None))
|
values=values, metadata=None))
|
||||||
for c in xrange(1, remove_counter):
|
for c in xrange(1, remove_counter):
|
||||||
db.aggregate_delete(ctxt, aggregates[c - 1].id)
|
db.aggregate_delete(ctxt, aggregates[c - 1].id)
|
||||||
results = db.aggregate_get_all(ctxt, read_deleted='no')
|
results = db.aggregate_get_all(ctxt)
|
||||||
self.assertEqual(len(results), add_counter - remove_counter)
|
self.assertEqual(len(results), add_counter - remove_counter)
|
||||||
|
|
||||||
def test_aggregate_metadata_add(self):
|
def test_aggregate_metadata_add(self):
|
||||||
@@ -633,8 +632,7 @@ class AggregateDBApiTestCase(test.TestCase):
|
|||||||
host = _get_fake_aggr_hosts()[0]
|
host = _get_fake_aggr_hosts()[0]
|
||||||
db.aggregate_host_delete(ctxt, result.id, host)
|
db.aggregate_host_delete(ctxt, result.id, host)
|
||||||
db.aggregate_host_add(ctxt, result.id, host)
|
db.aggregate_host_add(ctxt, result.id, host)
|
||||||
expected = db.aggregate_host_get_all(ctxt, result.id,
|
expected = db.aggregate_host_get_all(ctxt, result.id)
|
||||||
read_deleted='no')
|
|
||||||
self.assertEqual(len(expected), 1)
|
self.assertEqual(len(expected), 1)
|
||||||
|
|
||||||
def test_aggregate_host_add_duplicate_raise_conflict(self):
|
def test_aggregate_host_add_duplicate_raise_conflict(self):
|
||||||
@@ -671,8 +669,7 @@ class AggregateDBApiTestCase(test.TestCase):
|
|||||||
result = _create_aggregate_with_hosts(context=ctxt, metadata=None)
|
result = _create_aggregate_with_hosts(context=ctxt, metadata=None)
|
||||||
db.aggregate_host_delete(ctxt, result.id,
|
db.aggregate_host_delete(ctxt, result.id,
|
||||||
_get_fake_aggr_hosts()[0])
|
_get_fake_aggr_hosts()[0])
|
||||||
expected = db.aggregate_host_get_all(ctxt, result.id,
|
expected = db.aggregate_host_get_all(ctxt, result.id)
|
||||||
read_deleted='no')
|
|
||||||
self.assertEqual(0, len(expected))
|
self.assertEqual(0, len(expected))
|
||||||
|
|
||||||
def test_aggregate_host_delete_raise_not_found(self):
|
def test_aggregate_host_delete_raise_not_found(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user