fixtures: - APIFixture defaults: request_headers: x-auth-token: admin accept: application/json content-type: application/json openstack-api-version: placement latest vars: - &agg_1 f918801a-5e54-4bee-9095-09a9d0c786b8 - &agg_2 a893eb5c-e2a0-4251-ab26-f71d3b0cfc0b tests: - name: get aggregates for bad resource provider GET: /resource_providers/6984bb2d-830d-4c8d-ac64-c5a8103664be/aggregates status: 404 response_json_paths: $.errors[0].title: Not Found - name: put aggregates for bad resource provider PUT: /resource_providers/6984bb2d-830d-4c8d-ac64-c5a8103664be/aggregates data: [] status: 404 response_json_paths: $.errors[0].title: Not Found - name: post new resource provider POST: /resource_providers data: name: $ENVIRON['RP_NAME'] uuid: $ENVIRON['RP_UUID'] status: 200 response_headers: location: //resource_providers/[a-f0-9-]+/ - name: get empty aggregates GET: /resource_providers/$ENVIRON['RP_UUID']/aggregates response_json_paths: $.aggregates: [] - name: aggregates 404 for out of date microversion get GET: /resource_providers/$ENVIRON['RP_UUID']/aggregates request_headers: openstack-api-version: placement 1.0 status: 404 response_json_paths: $.errors[0].title: Not Found - name: aggregates 404 for out of date microversion put PUT: /resource_providers/$ENVIRON['RP_UUID']/aggregates request_headers: openstack-api-version: placement 1.0 status: 404 response_json_paths: $.errors[0].title: Not Found - name: put some aggregates - old payload and new microversion PUT: $LAST_URL data: - *agg_1 - *agg_2 status: 400 response_strings: - JSON does not validate response_json_paths: $.errors[0].title: Bad Request - name: put some aggregates - new payload and old microversion PUT: $LAST_URL request_headers: openstack-api-version: placement 1.18 data: resource_provider_generation: 0 aggregates: - *agg_1 - *agg_2 status: 400 response_strings: - JSON does not validate response_json_paths: $.errors[0].title: Bad Request - name: put some aggregates - new payload and new microversion PUT: $LAST_URL data: resource_provider_generation: 0 aggregates: - *agg_1 - *agg_2 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_json_paths: $.aggregates[0]: *agg_1 $.aggregates[1]: *agg_2 $.resource_provider_generation: 1 - name: get those aggregates GET: $LAST_URL response_headers: cache-control: no-cache # Does last-modified look like a legit timestamp? last-modified: /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/ response_json_paths: $.aggregates.`len`: 2 - name: clear those aggregates - generation conflict PUT: $LAST_URL data: resource_provider_generation: 0 aggregates: [] status: 409 response_json_paths: $.errors[0].code: placement.concurrent_update - name: clear those aggregates PUT: $LAST_URL data: resource_provider_generation: 1 aggregates: [] status: 200 response_json_paths: $.aggregates: [] - name: get empty aggregates again GET: /resource_providers/$ENVIRON['RP_UUID']/aggregates response_json_paths: $.aggregates: [] - name: put non json PUT: $LAST_URL data: '{"bad", "not json"}' status: 400 response_strings: - Malformed JSON response_json_paths: $.errors[0].title: Bad Request - name: put invalid json no generation PUT: $LAST_URL data: aggregates: - *agg_1 - *agg_2 status: 400 response_strings: - JSON does not validate response_json_paths: $.errors[0].title: Bad Request - name: put invalid json not uuids PUT: $LAST_URL data: aggregates: - harry - sally resource_provider_generation: 2 status: 400 response_strings: - "is not a 'uuid'" response_json_paths: $.errors[0].title: Bad Request - name: put same aggregates twice PUT: $LAST_URL data: aggregates: - *agg_1 - *agg_1 resource_provider_generation: 2 status: 400 response_strings: - has non-unique elements response_json_paths: $.errors[0].title: Bad Request # The next two tests confirm that prior to version 1.15 we do # not set the cache-control or last-modified headers on either # PUT or GET. - name: put some aggregates v1.14 PUT: $LAST_URL request_headers: openstack-api-version: placement 1.14 data: - *agg_1 - *agg_2 response_forbidden_headers: - last-modified - cache-control - name: get those aggregates v1.14 GET: $LAST_URL request_headers: openstack-api-version: placement 1.14 response_forbidden_headers: - last-modified - cache-control