~rackspace-titan/glance/glance-clear-lp766295

  • Committer: Tarmac
  • Author(s): jaypipes at gmail
  • Date: 2011-02-23 21:27:24 UTC
  • mfrom: (70.4.12 bug704854)
  • Revision ID: tarmac-20110223212724-uyyhaqiroveemkjb
This adds a test case for LP Bug 704854 -- Exception
raised by Registry server gets eaten by API server.

The test involves spinning up an API server and a registry
server, firing cURL and glance-upload against the API
server with invalid requests, and verifying that appropriate
exception messages are contained in the response. 

I should probably rebase this commit considering all the previous
commits weren't actually addressing the issue. The fact that I
had glance-api and glance-registry installed on my local machine
was causing the test runs to improperly return a passing result.
  
It just so happens that the glance-api and glance-registry that
I had installed to my /usr/local/bin were the very same programs
that were from a previous branch I had locally where I fixed the
root cause of this issue, which was that the sqlalchemy @validates
decorator does NOT fire for *new* objects, only existing ones, which
resulted in image_create() improperly storing NULL data in type, name,
and other non-nullable fields in the database. This then set off
a domino effect which caused the next call from
glance.server._upload_and_activate() to die a horrible death due to
the @validates decorator then firing on the already-created Image
object. This horrible death was improperly being raised from the
glance.client as a BadRequest instead of exception.Invalid, which
caused the API server to ignore the text in the actual Invalid
exception coming from the registry server.
  
In short, this patch finally fixes the root of the problem by
placing a validate_image() function guard which throws exception.Invalid
for any invalid data coming into the _image_update() method in the db
API. It also adds a bunch of logging statements and ensures that
exceptions throughout the call stack between the API server to the
glance.registry.Client to the Registry server are properly handled and
that the text of those exceptions isn't thrown away willy-nilly.
Filename Latest Rev Last Changed Committer Comment Size
..
bin 3.1.1 14 years ago Monty Taylor Reorg to make Monty's build pedanticness side happ Diff
doc 3.1.2 14 years ago Monty Taylor Added setup.py and sphinx docs. Diff
etc 59.2.1 13 years ago jaypipes at gmail First round of logging functionality: * Adds opti Diff
glance 4.1.1 14 years ago jaypipes at gmail libify glance into teller and parallax modules. Ma Diff
tests 3.1.1 14 years ago Monty Taylor Reorg to make Monty's build pedanticness side happ Diff
tools 11.1.1 13 years ago jaypipes at gmail First round of cleaning up the unittests. Adds tes Diff
.bzrignore 62.3.3 13 years ago jaypipes at gmail Ignore build and deploy-related files 99 bytes Diff Download File
File builddeb.sh 50.2.12 13 years ago Cerberus A few more 685 bytes Diff Download File
MANIFEST.in 70.4.8 13 years ago jaypipes at gmail Use Nova's path trick in all bins... 299 bytes Diff Download File
pylintrc 17.1.1 13 years ago jaypipes at gmail Packaging fixups 812 bytes Diff Download File
README 64.1.4 13 years ago Rick Harris Removing dubious advice 1.2 KB Diff Download File
run_tests.py 50.2.12 13 years ago Cerberus A few more 2 KB Diff Download File
File run_tests.sh 64.1.3 13 years ago Rick Harris Including tests/ in pep8 2.5 KB Diff Download File
setup.cfg 3.1.2 14 years ago Monty Taylor Added setup.py and sphinx docs. 134 bytes Diff Download File
setup.py 62.3.14 13 years ago jaypipes at gmail Fixes for Rick review #2 2.9 KB Diff Download File