Regression test for bug 1779818

This patch adds a test that shows that when updating a parent provider
of a resource provider, placement doesn't update a root provider of
another resource provider in the same tree.

Change-Id: I4f58752444cf6dff6b19dabd7a5a829cbf636678
Related-Bug: #1779818
This commit is contained in:
Tetsuro Nakamura 2018-07-02 07:32:18 +09:00
parent 87e1951a1b
commit f87ed5109b
1 changed files with 126 additions and 0 deletions

View File

@ -0,0 +1,126 @@
# Test launchpad bug https://bugs.launchpad.net/nova/+bug/1779818
fixtures:
- APIFixture
defaults:
request_headers:
x-auth-token: admin
accept: application/json
openstack-api-version: placement latest
tests:
- name: post a resource provider as alt_parent
POST: /resource_providers
request_headers:
content-type: application/json
data:
name: alt_parent
uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
status: 200
response_json_paths:
$.uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
$.name: alt_parent
$.parent_provider_uuid: null
$.generation: 0
- name: post another resource provider as parent
POST: /resource_providers
request_headers:
content-type: application/json
data:
name: parent
uuid: $ENVIRON['PARENT_PROVIDER_UUID']
status: 200
response_json_paths:
$.uuid: $ENVIRON['PARENT_PROVIDER_UUID']
$.name: parent
$.parent_provider_uuid: null
$.generation: 0
- name: post a child resource provider of the parent
POST: /resource_providers
request_headers:
content-type: application/json
data:
name: child
uuid: $ENVIRON['RP_UUID']
parent_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID']
status: 200
response_json_paths:
$.uuid: $ENVIRON['RP_UUID']
$.name: child
$.parent_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID']
$.generation: 0
# Let's validate that now we have two tree structures
# * alt_parent
# * parent
# |
# +-- child
- name: list all resource providers
GET: /resource_providers
response_json_paths:
$.resource_providers.`len`: 3
$.resource_providers[?uuid="$ENVIRON['ALT_PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
$.resource_providers[?uuid="$ENVIRON['ALT_PARENT_PROVIDER_UUID']"].parent_provider_uuid: null
$.resource_providers[?uuid="$ENVIRON['PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID']
$.resource_providers[?uuid="$ENVIRON['PARENT_PROVIDER_UUID']"].parent_provider_uuid: null
$.resource_providers[?uuid="$ENVIRON['RP_UUID']"].root_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID']
$.resource_providers[?uuid="$ENVIRON['RP_UUID']"].parent_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID']
# Let's re-parent the parent to the alternative parent
# so that we have only one tree.
# * alt_parent
# |
# +-- parent
# |
# +-- child
- name: update a parent of the parent
PUT: /resource_providers/$ENVIRON['PARENT_PROVIDER_UUID']
request_headers:
content-type: application/json
data:
name: parent
parent_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
status: 200
# Let's validate that we have only one root provider now
- name: list all resource providers updated
GET: /resource_providers
response_json_paths:
$.resource_providers.`len`: 3
$.resource_providers[?uuid="$ENVIRON['ALT_PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
$.resource_providers[?uuid="$ENVIRON['ALT_PARENT_PROVIDER_UUID']"].parent_provider_uuid: null
$.resource_providers[?uuid="$ENVIRON['PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
$.resource_providers[?uuid="$ENVIRON['PARENT_PROVIDER_UUID']"].parent_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
# Bug#1779818: The child's root should be updated to the alt_parent,
# but we actually still get the native parent for root.
# $.resource_providers[?uuid="$ENVIRON['RP_UUID']"].root_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
$.resource_providers[?uuid="$ENVIRON['RP_UUID']"].root_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID']
$.resource_providers[?uuid="$ENVIRON['RP_UUID']"].parent_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID']
- name: list all resource providers in a tree with the child
GET: /resource_providers?in_tree=$ENVIRON['RP_UUID']
response_json_paths:
# There should be 3 providers but we actually get 2
$.resource_providers.`len`: 2
$.resource_providers[?uuid="$ENVIRON['RP_UUID']"].root_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID']
$.resource_providers[?uuid="$ENVIRON['PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
- name: list all resource providers in a tree with the parent
GET: /resource_providers?in_tree=$ENVIRON['PARENT_PROVIDER_UUID']
response_json_paths:
# There should be 3 providers but we actually get 2
$.resource_providers.`len`: 2
$.resource_providers[?uuid="$ENVIRON['ALT_PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
$.resource_providers[?uuid="$ENVIRON['PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
- name: list all resource providers in a tree with the alternative parent
GET: /resource_providers?in_tree=$ENVIRON['ALT_PARENT_PROVIDER_UUID']
response_json_paths:
# There should be 3 providers but we actually get 2
$.resource_providers.`len`: 2
$.resource_providers[?uuid="$ENVIRON['ALT_PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']
$.resource_providers[?uuid="$ENVIRON['PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID']