placement/placement/tests/functional/gabbits/allocation-candidates-mappi...

78 lines
2.8 KiB
YAML

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Tests for allocation request mappings.
fixtures:
# See the layout diagram in this fixture's docstring in ../fixtures.py
- GranularFixture
defaults:
request_headers:
x-auth-token: admin
content-type: application/json
accept: application/json
# 1.34 is the microversion at which mappings are expected
openstack-api-version: placement 1.34
tests:
- name: simple mapping non granular
GET: /allocation_candidates
query_parameters:
resources: VCPU:1
required: HW_CPU_X86_SSE
response_json_paths:
$.allocation_requests.`len`: 1
$.provider_summaries.`len`: 1
$.allocation_requests[0].allocations["$ENVIRON['CN_MIDDLE']"].resources:
VCPU: 1
$.allocation_requests[0].mappings:
"":
- $ENVIRON['CN_MIDDLE']
- name: simple mapping with shared
GET: /allocation_candidates
query_parameters:
resources: VCPU:1,DISK_GB:1
required: HW_CPU_X86_SSE
response_json_paths:
$.allocation_requests.`len`: 2
$.provider_summaries.`len`: 3
$.allocation_requests[0].allocations["$ENVIRON['CN_MIDDLE']"].resources:
VCPU: 1
# We can't cleanly test for which providers will show up in which
# mappings in this request, so instead we confirm the size. Other tests
# cover which suitably.
$.allocation_requests[0].mappings.`len`: 1
$.allocation_requests[0].mappings[""].`len`: 2
$.allocation_requests[1].mappings.`len`: 1
$.allocation_requests[1].mappings[""].`len`: 2
- name: group mapping with shared
GET: /allocation_candidates
query_parameters:
resources: VCPU:1
resources_DISK_A: DISK_GB:1
resources_DISK_B: DISK_GB:1
required: HW_CPU_X86_SSE
group_policy: isolate
response_json_paths:
$.allocation_requests.`len`: 2
$.provider_summaries.`len`: 3
$.allocation_requests[0].allocations["$ENVIRON['CN_MIDDLE']"].resources:
VCPU: 1
$.allocation_requests[0].mappings.`len`: 3
$.allocation_requests[0].mappings[""][0]: $ENVIRON['CN_MIDDLE']
$.allocation_requests[0].mappings['_DISK_A'][0]: /(?:$ENVIRON['SHR_DISK_1']|$ENVIRON['SHR_DISK_2'])/
$.allocation_requests[0].mappings['_DISK_B'][0]: /(?:$ENVIRON['SHR_DISK_1']|$ENVIRON['SHR_DISK_2'])/