Incorrect response codes for GET images validation tests

Bug #1008456 reported by Rohit Karajgi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Unassigned

Bug Description

Our tempest tests that validate the return error codes for the following scenarios fail and return an incorrect error/exception
code.

GET images:
1. test_get_image_when_image_id_is_empty
2. test_get_image_when_image_id_is_negative_value
3. test_get_image_when_image_id_is_non_hex_string (Eg: 'abcdefghi-12340-klmn-32332322')

Actual response code : 404 Not Found
Expected response code: 400 Bad Request

4. test_get_image_when_image_id_is_over_36_chars (Eg: 'aabbcc11-aab1-aab1-ccd2-123456789abc-a4551e90')

Actual response code : 404 Not Found
Expected response code: 413 OverLimit

The above failures have been observed on stable/essex branch.

Revision history for this message
Brian Waldon (bcwaldon) wrote :

I would argue strongly that the return codes you documented being returned are actually correct. You should just update tempest to expect them.

Revision history for this message
Rohit Karajgi (rohitk) wrote :

I agree that these expected response code expectations are arguable, hence I would like to seek opinion.
IMO, for any Image ID that is not in the standard UUID format/syntax, should return a 400 BadRequest. A 404 NotFound requires
an additional database lookup to determine that the data is actually not present, which should ideally be avoided.

Also, 404 NotFound expects the data stream to be correct(valid) but the data is just not available.

For #4, I guess a 400 BadRequest makes more sense than 413 OverLimit.

Changed in nova:
status: New → Opinion
Revision history for this message
Brian Waldon (bcwaldon) wrote :

In a RESTful API, if an identifier cannot be found (for whatever user-caused fault: validity, existence, etc), a 404 shall be returned. No matter how you look at it, the URI does not exist. The fact that an id is not a uuid is an implementation detail of Nova and we should not treat that case differently - we still can't find the entity.

Brian Waldon (bcwaldon)
Changed in nova:
status: Opinion → Invalid
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.