rest_client swallows HTTP 415 (Unsupported Media Typ) status code

Bug #1407140 reported by Gilbert Pilz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Medium
Ghanshyam Mann

Bug Description

If you try to use the tempest rest_client to test whether a service properly responds with an HTTP 415, "Unsupported Media Type", status, the rest_client code responds with an "UnexpectedResponseCode" exception. Since this exception acts as a catch-all for several HTTP errors it is difficult to tell whether or not the correct (415) status was returned in the response. The correct behavior should be to check for a response status of 415 and, if so, throw the "InvalidContentType" exception.

Revision history for this message
Ghanshyam Mann (ghanshyammann) wrote :

Currently, glance V2 API support two media types ( 'application/openstack-images-v2.1-json-patch' & 'application/openstack-images-v2.0-json-patch' ).

Tempest always send request with supported media type only and that's why 415 did not happen. ( https://github.com/openstack/tempest/blob/master/tempest/services/image/v2/json/image_client.py#L62 )

But as rest_client is on the way to be part of tempest-lib, its better to handle 415 and raise appropriate error.

Changed in tempest:
status: New → Triaged
assignee: nobody → Ghanshyam Mann (ghanshyammann)
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

Fix proposed to branch: master
Review: https://review.openstack.org/144951

Changed in tempest:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest (master)

Reviewed: https://review.openstack.org/144951
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=a5904000bd1414e7b2bddf96b44a26a6ea9156a4
Submitter: Jenkins
Branch: master

commit a5904000bd1414e7b2bddf96b44a26a6ea9156a4
Author: ghanshyam <email address hidden>
Date: Mon Jan 5 17:38:56 2015 +0900

    Handle HTTP 415 in rest_client

    If HTTP 415 ("Unsupported Media Type") is returned then,
    rest_client responds with an "UnexpectedResponseCode" exception.

    Tempest always send request with supported media type and that's
    why 415 did not happen.
    But as rest_client is on the way to be part of tempest-lib,
    its better to handle 415 and raise appropriate error.

    This patch handle HTTP 415 error and raise 'InvalidContentType'.

    Change-Id: I72690aab7afd8e68f054f31315a8b1576a7ec9c4
    Closes-Bug: #1407140

Changed in tempest:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.