fixtures: - APIFixture defaults: request_headers: x-auth-token: admin accept: application/json openstack-api-version: placement latest tests: - name: what is at resource providers GET: /resource_providers request_headers: # microversion 1.15 for cache headers openstack-api-version: placement 1.15 response_json_paths: $.resource_providers: [] response_headers: cache-control: no-cache # Does last-modified look like a legit timestamp? last-modified: /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/ - name: non admin forbidden GET: /resource_providers request_headers: x-auth-token: user accept: application/json status: 403 response_json_paths: $.errors[0].title: Forbidden - name: non admin forbidden non json GET: /resource_providers request_headers: x-auth-token: user accept: text/plain status: 403 response_strings: - admin required - name: post new resource provider POST: /resource_providers request_headers: content-type: application/json data: name: $ENVIRON['RP_NAME'] uuid: $ENVIRON['RP_UUID'] status: 201 response_headers: location: //resource_providers/[a-f0-9-]+/ response_forbidden_headers: - content-type # On this one, don't test for which field was a duplicate because # that depends on how the database reports columns. - name: try to create same all again POST: /resource_providers request_headers: content-type: application/json data: name: $ENVIRON['RP_NAME'] uuid: $ENVIRON['RP_UUID'] status: 409 response_strings: - Conflicting resource provider response_json_paths: $.errors[0].title: Conflict - name: try to create same name again POST: /resource_providers request_headers: content-type: application/json data: name: $ENVIRON['RP_NAME'] uuid: ada30fb5-566d-4fe1-b43b-28a9e988790c status: 409 response_strings: - "Conflicting resource provider name: $ENVIRON['RP_NAME'] already exists" response_json_paths: $.errors[0].title: Conflict - name: confirm the correct post GET: /resource_providers/$ENVIRON['RP_UUID'] request_headers: content-type: application/json openstack-api-version: placement 1.15 response_headers: content-type: application/json cache-control: no-cache # Does last-modified look like a legit timestamp? last-modified: /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/ response_json_paths: $.uuid: $ENVIRON['RP_UUID'] $.name: $ENVIRON['RP_NAME'] $.parent_provider_uuid: null $.generation: 0 $.links[?rel = "self"].href: /resource_providers/$ENVIRON['RP_UUID'] $.links[?rel = "inventories"].href: /resource_providers/$ENVIRON['RP_UUID']/inventories $.links[?rel = "usages"].href: /resource_providers/$ENVIRON['RP_UUID']/usages - name: get resource provider works with no accept GET: /resource_providers/$ENVIRON['RP_UUID'] response_headers: content-type: /application/json/ response_json_paths: $.uuid: $ENVIRON['RP_UUID'] - name: get non-existing resource provider GET: /resource_providers/d67370b5-4dc0-470d-a4fa-85e8e89abc6c status: 404 response_strings: - No resource provider with uuid d67370b5-4dc0-470d-a4fa-85e8e89abc6c found response_json_paths: $.errors[0].title: Not Found - name: list one resource providers GET: /resource_providers request_headers: openstack-api-version: placement 1.15 response_json_paths: $.resource_providers.`len`: 1 $.resource_providers[0].uuid: $ENVIRON['RP_UUID'] $.resource_providers[0].name: $ENVIRON['RP_NAME'] $.resource_providers[0].generation: 0 $.resource_providers[0].parent_provider_uuid: null $.resource_providers[0].links[?rel = "self"].href: /resource_providers/$ENVIRON['RP_UUID'] $.resource_providers[0].links[?rel = "inventories"].href: /resource_providers/$ENVIRON['RP_UUID']/inventories $.resource_providers[0].links[?rel = "usages"].href: /resource_providers/$ENVIRON['RP_UUID']/usages response_headers: cache-control: no-cache # Does last-modified look like a legit timestamp? last-modified: /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/ - name: filter out all resource providers by name GET: /resource_providers?name=flubblebubble response_json_paths: $.resource_providers.`len`: 0 - name: filter out all resource providers by uuid GET: /resource_providers?uuid=d67370b5-4dc0-470d-a4fa-85e8e89abc6c response_json_paths: $.resource_providers.`len`: 0 - name: list one resource provider filtering by name GET: /resource_providers?name=$ENVIRON['RP_NAME'] response_json_paths: $.resource_providers.`len`: 1 $.resource_providers[0].uuid: $ENVIRON['RP_UUID'] $.resource_providers[0].name: $ENVIRON['RP_NAME'] $.resource_providers[0].links[?rel = "self"].href: /resource_providers/$ENVIRON['RP_UUID'] $.resource_providers[0].links[?rel = "inventories"].href: /resource_providers/$ENVIRON['RP_UUID']/inventories $.resource_providers[0].links[?rel = "usages"].href: /resource_providers/$ENVIRON['RP_UUID']/usages - name: list resource providers filtering by invalid uuid GET: /resource_providers?uuid=spameggs status: 400 response_strings: - 'Invalid query string parameters' response_json_paths: $.errors[0].title: Bad Request - name: list resource providers providing an invalid filter GET: /resource_providers?spam=eggs status: 400 response_strings: - 'Invalid query string parameters' response_json_paths: $.errors[0].title: Bad Request - name: list one resource provider filtering by uuid with allocations link GET: /resource_providers?uuid=$ENVIRON['RP_UUID'] request_headers: openstack-api-version: placement 1.11 response_json_paths: $.resource_providers.`len`: 1 $.resource_providers[0].uuid: $ENVIRON['RP_UUID'] $.resource_providers[0].name: $ENVIRON['RP_NAME'] $.resource_providers[0].links.`len`: 6 $.resource_providers[0].links[?rel = "self"].href: /resource_providers/$ENVIRON['RP_UUID'] $.resource_providers[0].links[?rel = "inventories"].href: /resource_providers/$ENVIRON['RP_UUID']/inventories $.resource_providers[0].links[?rel = "usages"].href: /resource_providers/$ENVIRON['RP_UUID']/usages $.resource_providers[0].links[?rel = "allocations"].href: /resource_providers/$ENVIRON['RP_UUID']/allocations - name: list one resource provider filtering by uuid no allocations link GET: /resource_providers?uuid=$ENVIRON['RP_UUID'] request_headers: openstack-api-version: placement 1.10 response_json_paths: $.resource_providers.`len`: 1 $.resource_providers[0].uuid: $ENVIRON['RP_UUID'] $.resource_providers[0].name: $ENVIRON['RP_NAME'] $.resource_providers[0].links.`len`: 5 $.resource_providers[0].links[?rel = "self"].href: /resource_providers/$ENVIRON['RP_UUID'] $.resource_providers[0].links[?rel = "inventories"].href: /resource_providers/$ENVIRON['RP_UUID']/inventories $.resource_providers[0].links[?rel = "usages"].href: /resource_providers/$ENVIRON['RP_UUID']/usages - name: update a resource provider's name PUT: /resource_providers/$RESPONSE['$.resource_providers[0].uuid'] request_headers: content-type: application/json openstack-api-version: placement 1.15 data: name: new name status: 200 response_headers: content-type: /application/json/ cache-control: no-cache # Does last-modified look like a legit timestamp? last-modified: /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/ response_forbidden_headers: - location response_json_paths: $.generation: 0 $.name: new name $.uuid: $ENVIRON['RP_UUID'] $.links[?rel = "self"].href: /resource_providers/$ENVIRON['RP_UUID'] - name: check the name from that update GET: $LAST_URL response_json_paths: $.name: new name - name: update a provider poorly PUT: $LAST_URL request_headers: content-type: application/json data: badfield: new name status: 400 response_strings: - 'JSON does not validate' response_json_paths: $.errors[0].title: Bad Request # This section of tests validate nested resource provider relationships and # constraints. We attempt to set the parent provider UUID for the primary # resource provider to a UUID value of a provider we have not yet created and # expect a failure. We then create that parent provider record and attempt to # set the same parent provider UUID without also setting the root provider UUID # to the same value, with an expected failure. Finally, we set the primary # provider's root AND parent to the new provider UUID and verify success. - name: test POST microversion limits nested providers POST: /resource_providers request_headers: openstack-api-version: placement 1.13 content-type: application/json data: name: child parent_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID'] status: 400 response_strings: - 'JSON does not validate' - name: test PUT microversion limits nested providers PUT: /resource_providers/$ENVIRON['RP_UUID'] request_headers: openstack-api-version: placement 1.13 content-type: application/json data: name: child parent_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID'] status: 400 response_strings: - 'JSON does not validate' - name: fail trying to set a root provider UUID PUT: /resource_providers/$ENVIRON['RP_UUID'] request_headers: content-type: application/json data: root_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID'] status: 400 response_strings: - 'JSON does not validate' - name: fail trying to self-parent POST: /resource_providers request_headers: content-type: application/json data: name: child uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID'] parent_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID'] status: 400 response_strings: - 'parent provider UUID cannot be same as UUID' - 'Unable to create resource provider \"child\", $ENVIRON["ALT_PARENT_PROVIDER_UUID"]:' - name: update a parent provider UUID to non-existing provider PUT: /resource_providers/$ENVIRON['RP_UUID'] request_headers: content-type: application/json data: name: parent parent_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID'] status: 400 response_strings: - 'parent provider UUID does not exist' - name: now create the parent provider POST: /resource_providers request_headers: content-type: application/json data: name: parent uuid: $ENVIRON['PARENT_PROVIDER_UUID'] status: 201 - name: get provider with old microversion no root provider UUID field GET: /resource_providers/$ENVIRON['PARENT_PROVIDER_UUID'] request_headers: openstack-api-version: placement 1.13 content-type: application/json response_json_paths: $.`len`: 4 name: parent status: 200 - name: get provider has root provider UUID field GET: /resource_providers/$ENVIRON['PARENT_PROVIDER_UUID'] request_headers: content-type: application/json response_json_paths: $.`len`: 6 name: parent root_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID'] parent_provider_uuid: null status: 200 - name: update a parent PUT: /resource_providers/$ENVIRON['RP_UUID'] request_headers: content-type: application/json data: name: child parent_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID'] status: 200 - name: get provider has new parent and root provider UUID field GET: /resource_providers/$ENVIRON['RP_UUID'] request_headers: content-type: application/json response_json_paths: name: child root_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID'] parent_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID'] status: 200 - name: fail trying to un-parent PUT: /resource_providers/$ENVIRON['RP_UUID'] request_headers: content-type: application/json data: name: child parent_provider_uuid: null status: 400 response_strings: - 'un-parenting a provider is not currently allowed' - name: 409 conflict while trying to delete parent with existing child DELETE: /resource_providers/$ENVIRON['PARENT_PROVIDER_UUID'] status: 409 response_strings: - "Unable to delete parent resource provider $ENVIRON['PARENT_PROVIDER_UUID']: It has child resource providers." - name: list all resource providers in a tree that does not exist GET: /resource_providers?in_tree=$ENVIRON['ALT_PARENT_PROVIDER_UUID'] response_json_paths: $.resource_providers.`len`: 0 - name: list all resource providers in a tree with multiple providers in tree GET: /resource_providers?in_tree=$ENVIRON['RP_UUID'] response_json_paths: $.resource_providers.`len`: 2 # Verify that we have both the parent and child in the list $.resource_providers[?uuid="$ENVIRON['PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID'] $.resource_providers[?uuid="$ENVIRON['RP_UUID']"].root_provider_uuid: $ENVIRON['PARENT_PROVIDER_UUID'] - name: create a new parent provider POST: /resource_providers request_headers: content-type: application/json data: name: altwparent uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID'] status: 201 response_headers: location: //resource_providers/[a-f0-9-]+/ response_forbidden_headers: - content-type - name: list all resource providers in a tree GET: /resource_providers?in_tree=$ENVIRON['ALT_PARENT_PROVIDER_UUID'] response_json_paths: $.resource_providers.`len`: 1 $.resource_providers[?uuid="$ENVIRON['ALT_PARENT_PROVIDER_UUID']"].root_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID'] - name: fail trying to re-parent to a different provider PUT: /resource_providers/$ENVIRON['RP_UUID'] request_headers: content-type: application/json data: name: child parent_provider_uuid: $ENVIRON['ALT_PARENT_PROVIDER_UUID'] status: 400 response_strings: - 're-parenting a provider is not currently allowed' - name: create a new provider POST: /resource_providers request_headers: content-type: application/json data: name: cow status: 201 - name: try to rename that provider to existing name PUT: $LOCATION request_headers: content-type: application/json data: name: child status: 409 response_json_paths: $.errors[0].title: Conflict - name: fail to put that provider with uuid PUT: $LAST_URL request_headers: content-type: application/json data: name: second new name uuid: 7d4275fc-8b40-4995-85e2-74fcec2cb3b6 status: 400 response_strings: - Additional properties are not allowed response_json_paths: $.errors[0].title: Bad Request - name: delete resource provider DELETE: $LAST_URL status: 204 - name: 404 on deleted provider DELETE: $LAST_URL status: 404 response_json_paths: $.errors[0].title: Not Found - name: fail to get a provider GET: /resource_providers/random_sauce status: 404 response_json_paths: $.errors[0].title: Not Found - name: delete non-existing resource provider DELETE: /resource_providers/d67370b5-4dc0-470d-a4fa-85e8e89abc6c status: 404 response_strings: - No resource provider with uuid d67370b5-4dc0-470d-a4fa-85e8e89abc6c found for delete response_json_paths: $.errors[0].title: Not Found - name: post resource provider no uuid POST: /resource_providers request_headers: content-type: application/json data: name: a name status: 201 response_headers: location: //resource_providers/[a-f0-9-]+/ - name: post malformed json as json POST: /resource_providers request_headers: content-type: application/json data: '{"foo": }' status: 400 response_strings: - 'Malformed JSON:' response_json_paths: $.errors[0].title: Bad Request - name: post bad uuid in resource provider POST: /resource_providers request_headers: content-type: application/json data: name: my bad rp uuid: this is not a uuid status: 400 response_strings: - "Failed validating 'format'" response_json_paths: $.errors[0].title: Bad Request - name: try to create resource provider with name exceed max characters POST: /resource_providers request_headers: content-type: application/json data: name: &name_exceeds_max_length_check This is a long text of 201 charactersssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss status: 400 response_strings: - "Failed validating 'maxLength'" response_json_paths: $.errors[0].title: Bad Request - name: try to update resource provider with name exceed max characters PUT: /resource_providers/$ENVIRON['RP_UUID'] request_headers: content-type: application/json data: name: *name_exceeds_max_length_check status: 400 response_strings: - "Failed validating 'maxLength'" response_json_paths: $.errors[0].title: Bad Request - name: confirm no cache-control headers before 1.15 GET: /resource_providers request_headers: openstack-api-version: placement 1.14 response_forbidden_headers: - cache-control - last-modified