def test_aggregate_host_delete(self): """Ensure we can add host to the aggregate.""" ctxt = context.get_admin_context() result = _create_aggregate_with_hosts(context=ctxt, metadata=None) db.aggregate_host_delete(ctxt, result.id, _get_fake_aggr_hosts()[0]) expected = db.aggregate_host_get_all(ctxt, result.id) self.assertEqual(0, len(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) self.assertEqual(len(expected), 1)