Skip to content

Instantly share code, notes, and snippets.

@mriedem
Created March 7, 2017 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mriedem/1fb38bd4bb62cff0c5bcd90abb049c88 to your computer and use it in GitHub Desktop.
Save mriedem/1fb38bd4bb62cff0c5bcd90abb049c88 to your computer and use it in GitHub Desktop.
user@xubuntu:~/git/nova$ git diff
diff --git a/nova/tests/functional/api/openstack/placement/test_report_client.py b/nova/tests/functional/api/openstack/placement/test_report_client.py
index 3700366..41c0229 100644
--- a/nova/tests/functional/api/openstack/placement/test_report_client.py
+++ b/nova/tests/functional/api/openstack/placement/test_report_client.py
@@ -18,6 +18,7 @@ from wsgi_intercept import interceptor
from nova.api.openstack.placement import deploy
from nova import conf
+from nova import exception
from nova import objects
from nova.objects import fields
from nova.scheduler.client import report
@@ -162,3 +163,19 @@ class SchedulerReportClientTests(test.TestCase):
resp = self.client.get(inventory_url)
inventory_data = resp.json()['inventories']
self.assertEqual({}, inventory_data)
+
+ # Try setting some invalid inventory and make sure the report
+ # client raises the expected error.
+ inv_data = {
+ 'BAD_FOO': {
+ 'total': 100,
+ 'reserved': 0,
+ 'min_unit': 1,
+ 'max_unit': 100,
+ 'step_size': 1,
+ 'allocation_ratio': 1.0,
+ },
+ }
+ self.assertRaises(exception.InvalidResourceClass,
+ self.client.set_inventory_for_provider,
+ self.compute_uuid, self.compute_name, inv_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment