# Bug 1714072 describes a situation where a resource provider is present in the # body of an allocation, but the resources object is empty. There should be at # least one resource class and value pair. If there is not a 400 response # should be returned. fixtures: - APIFixture defaults: request_headers: x-auth-token: admin accept: application/json content-type: application/json # Default to <= 1.11 so the PUT /allocations in here that use the # older list-ish format continue to work. openstack-api-version: placement 1.11 tests: - name: create a resource provider POST: /resource_providers data: name: an rp status: 201 - name: get resource provider GET: $LOCATION status: 200 - name: add inventory to an rp PUT: $RESPONSE['$.links[?rel = "inventories"].href'] data: resource_provider_generation: 0 inventories: VCPU: total: 24 MEMORY_MB: total: 1024 status: 200 - name: put a successful allocation PUT: /allocations/c9f0186b-64f8-44fb-b6c9-83008d8d6940 data: allocations: - resource_provider: uuid: $HISTORY['get resource provider'].$RESPONSE['$.uuid'] resources: VCPU: 1 MEMORY_MB: 1 project_id: 42a32c07-3eeb-4401-9373-68a8cdca6784 user_id: 66cb2f29-c86d-47c3-8af5-69ae7b778c70 status: 204 - name: fail with empty resources PUT: /allocations/c9f0186b-64f8-44fb-b6c9-83008d8d6940 data: allocations: - resource_provider: uuid: $HISTORY['get resource provider'].$RESPONSE['$.uuid'] resources: {} project_id: 42a32c07-3eeb-4401-9373-68a8cdca6784 user_id: 66cb2f29-c86d-47c3-8af5-69ae7b778c70 status: 400 response_strings: - does not have enough properties # The next two tests confirm that the bug identified by # this file's name is not present in the PUT /allocations/{consumer_uuid} # format added by microversion 1.12. - name: put a successful dictish allocation PUT: /allocations/c9f0186b-64f8-44fb-b6c9-83008d8d6940 request_headers: openstack-api-version: placement 1.12 data: allocations: $HISTORY['get resource provider'].$RESPONSE['$.uuid']: resources: VCPU: 1 MEMORY_MB: 1 project_id: 42a32c07-3eeb-4401-9373-68a8cdca6784 user_id: 66cb2f29-c86d-47c3-8af5-69ae7b778c70 status: 204 - name: fail with empty resources dictish PUT: /allocations/c9f0186b-64f8-44fb-b6c9-83008d8d6940 request_headers: openstack-api-version: placement 1.12 data: allocations: $HISTORY['get resource provider'].$RESPONSE['$.uuid']: resources: {} project_id: 42a32c07-3eeb-4401-9373-68a8cdca6784 user_id: 66cb2f29-c86d-47c3-8af5-69ae7b778c70 status: 400 response_strings: - does not have enough properties