[openstack-dev] [nova] Some help needed on these darn API sample tests

Jay Pipes jaypipes at gmail.com
Sat Jul 19 20:35:46 UTC 2014


Getting very frustrated, hoping someone can walk me back from the cliff.

I am trying to fix this simple bug:

https://bugs.launchpad.net/nova/+bug/1343080

The fix for it is ridiculously simple. It is removing this line:

https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/views/images.py#L121

Removing that one line breaks around 26 tests, 25 of which are related 
to the API sample tests in the nova/tests/integrated/ directory. I 
expected this, and ran the unit test suite after removing the one line 
above specifically to identify the places that would need to be changed.

I went to all of the API sample template files in 
/nova/tests/integrated/api_samples and removed the offending piece of 
the changed URI. A total of 14 API sample template files needed to be 
changed (something quite ridiculous in my opinion):

http://paste.openstack.org/show/87225/

When I re-ran the tests, all of them failed again. Suffice to say, the 
test failure outputs are virtually pointless, as they have a misleading 
error message:

http://paste.openstack.org/show/87226/

It's not that there are extra list items in the template, which is what 
the failure message says. The problem is that the API samples from the 
templates into the /doc/api_samples/ directory were not re-generated 
when the templates changed.

The README in the /nova/tests/integrated/api_samples/ directory has this 
useful advice:

== start ==

Then run the following command:

GENERATE_SAMPLES=True tox -epy27 nova.tests.integrated
Which will create the files on doc/api_samples.

If new tests are added or the .tpl files are changed due to bug fixes, 
the samples must be regenerated so they are in sync with the templates, 
as there is an additional test which reloads the documentation and 
ensures that it's in sync.

Debugging sample generation

If a .tpl is changed, its matching .xml and .json must be removed else 
the samples won't be generated. If an entirely new extension is added, a 
directory for it must be created before its samples will be generated.

== end ==

So, I took the advice of the README and deleted the api samples in 
question from the /docs/api_samples/ folder:

rm doc/api_samples/images-*
rm doc/api_samples/OS-DCF/image-*

And then ran the tox invocation from above:

GENERATE_SAMPLES=True tox -epy27 nova.tests.integrated.test_api_samples

Unfortunately, the above bombed out in testr and produces a bunch of 
garbage, which I am uncertain how to debug:

http://paste.openstack.org/show/87227/

Would someone mind giving me a hand on this? I'd really appreciate it. 
It really should not be this hard to make such a simple fix to the API 
code. :(

Thanks in advance,
-jay



More information about the OpenStack-dev mailing list