diff options
author | Tetsuro Nakamura <nakamura.tetsuro@lab.ntt.co.jp> | 2018-08-02 14:00:45 +0900 |
---|---|---|
committer | Tetsuro Nakamura <nakamura.tetsuro@lab.ntt.co.jp> | 2018-08-02 14:00:45 +0900 |
commit | e4923abaebeac7e70132bb3fb840a08a326408bc (patch) | |
tree | d99bcd93b89715d96ae21cd262f5e3a147b71b03 | |
parent | d4dbb42593893c1d1ed51a127b7183a314bcac2c (diff) | |
download | nova-e4923abaebeac7e70132bb3fb840a08a326408bc.tar.gz |
Increase max_unit in placement test fixture
In the AllocationFixture setup, to avoid the limitation of the
max_unit that is set to the inventory, we were using a bit hacky
way creating multiple allocation objects that have the same resource
class, the same consumer, and the same resource provider.
Since this is not how it works in real cases, and this prevents us
from refactoring, this patch fixes it.
Change-Id: I8ba378ff5eeaf6c9cca11c5874708a17d4640097
-rw-r--r-- | nova/tests/functional/api/openstack/placement/fixtures/gabbits.py | 26 | ||||
-rw-r--r-- | nova/tests/functional/api/openstack/placement/gabbits/resource-provider-resources-query.yaml | 2 |
2 files changed, 9 insertions, 19 deletions
diff --git a/nova/tests/functional/api/openstack/placement/fixtures/gabbits.py b/nova/tests/functional/api/openstack/placement/fixtures/gabbits.py index c63450437d..e542636b45 100644 --- a/nova/tests/functional/api/openstack/placement/fixtures/gabbits.py +++ b/nova/tests/functional/api/openstack/placement/fixtures/gabbits.py @@ -159,22 +159,17 @@ class AllocationFixture(APIFixture): inventory = rp_obj.Inventory( self.context, resource_provider=rp, resource_class='DISK_GB', total=2048, - step_size=10, min_unit=10, max_unit=600) + step_size=10, min_unit=10, max_unit=1000) inventory.obj_set_defaults() rp.add_inventory(inventory) - alloc1 = rp_obj.Allocation( - self.context, resource_provider=rp, - resource_class='DISK_GB', - consumer=consumer, - used=500) - alloc2 = rp_obj.Allocation( + alloc = rp_obj.Allocation( self.context, resource_provider=rp, resource_class='DISK_GB', consumer=consumer, - used=500) + used=1000) alloc_list = rp_obj.AllocationList( self.context, - objects=[alloc1, alloc2] + objects=[alloc] ) alloc_list.replace_all() @@ -190,22 +185,17 @@ class AllocationFixture(APIFixture): inventory = rp_obj.Inventory( self.context, resource_provider=rp, resource_class='VCPU', total=10, - max_unit=4) + max_unit=10) inventory.obj_set_defaults() rp.add_inventory(inventory) - alloc1 = rp_obj.Allocation( + alloc = rp_obj.Allocation( self.context, resource_provider=rp, resource_class='VCPU', consumer=consumer, - used=2) - alloc2 = rp_obj.Allocation( - self.context, resource_provider=rp, - resource_class='VCPU', - consumer=consumer, - used=4) + used=6) alloc_list = rp_obj.AllocationList( self.context, - objects=[alloc1, alloc2]) + objects=[alloc]) alloc_list.replace_all() # Create a consumer object for a different user diff --git a/nova/tests/functional/api/openstack/placement/gabbits/resource-provider-resources-query.yaml b/nova/tests/functional/api/openstack/placement/gabbits/resource-provider-resources-query.yaml index 48952b122f..f23e595b0f 100644 --- a/nova/tests/functional/api/openstack/placement/gabbits/resource-provider-resources-query.yaml +++ b/nova/tests/functional/api/openstack/placement/gabbits/resource-provider-resources-query.yaml @@ -117,7 +117,7 @@ tests: $.resource_providers.`len`: 0 - name: list resource providers providing resources (no match - more than max_unit) - GET: /resource_providers?resources=DISK_GB:610 + GET: /resource_providers?resources=DISK_GB:1010 response_json_paths: $.resource_providers.`len`: 0 |