← Back to team overview

openstack team mailing list archive

Re: Errors running individual tests that call into the database

 

On Mon, Jun 11, 2012 at 05:04:51PM +0100, John Garbutt wrote:
> Hi,
> 
> I am trying to run tests like "test_xenapi" and "test_libvirt" by
> themselves do things like:
>    nosetests test_xenapi
> But it does work, I get DB errors relating to missing tables.
> However, I can successfully run all the tests.
> 
> The way I understand it:
>  - nova.tests.__init__.py setup() does the database setup
>  - nova.test.py TestCase.setUp() does the resetting of the db
>  It is almost like doing "nosetests test_asdf" skips the database
> setup in nova.tests.__init__.py, is that correct?
> 
> Any ideas on how to run tests individually, but still get the
> database correclty initialized? Am I just calling the tests incorrectly?

I don't know the answer to your question, but I found this regression in
functionality was caused by the following commit:

  commit cf31b789927cedfd08c67dcf207b4a10ce2b1db6
  Author: Monty Taylor <mordred@xxxxxxxxxxxx>
  Date:   Sun Jun 3 13:03:21 2012 -0400

    Finalize tox config.
    
    Shrink tox.ini to the new short version.
    Fix the test cases to be able to be run in nosetets plus the
    openstack.nose_plugin, which finally removes the need for
    nova/testing/runner.py
    Also, now we'll just output directly to stdout, which will
    make nose collect the trace logging directly and either output
    it at the end of the run, or inject it into the xunit output
    appropriately.
    
    Change-Id: I1456e18a11a840145492038108bdfe812c8230d1

Before that commit, it was possible to just invoke something like

   ./run_tests.sh -N -P test_libvirt

from the nova top level GIT directory to run an individual test suite.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


Follow ups

References