summaryrefslogtreecommitdiffstats
path: root/nova/tests/test_db_api.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/tests/test_db_api.py')
-rw-r--r--nova/tests/test_db_api.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py
index a384181dd..121120dbf 100644
--- a/nova/tests/test_db_api.py
+++ b/nova/tests/test_db_api.py
@@ -304,7 +304,7 @@ class AggregateDBApiTestCase(test.TestCase):
def test_aggregate_create(self):
"""Ensure aggregate can be created with no metadata."""
result = _create_aggregate(metadata=None)
- self.assertEqual(result['operational_state'], 'building')
+ self.assertEqual(result['operational_state'], 'created')
def test_aggregate_create_raise_exist_exc(self):
"""Ensure aggregate names are distinct."""
@@ -476,6 +476,17 @@ class AggregateDBApiTestCase(test.TestCase):
expected = db.aggregate_host_get_all(ctxt, result.id)
self.assertEqual(_get_fake_aggr_hosts(), expected)
+ def test_aggregate_host_add_deleted(self):
+ """Ensure we can add a host that was previously deleted."""
+ ctxt = context.get_admin_context()
+ result = _create_aggregate_with_hosts(context=ctxt, metadata=None)
+ host = _get_fake_aggr_hosts()[0]
+ db.aggregate_host_delete(ctxt, result.id, host)
+ db.aggregate_host_add(ctxt, result.id, host)
+ expected = db.aggregate_host_get_all(ctxt, result.id,
+ read_deleted='no')
+ self.assertEqual(len(expected), 1)
+
def test_aggregate_host_add_duplicate_raise_conflict(self):
"""Ensure we cannot add host to distinct aggregates."""
ctxt = context.get_admin_context()