[Openstack] Unit Test Error when test servers.py using tox

Pei Pei2 Jia jiapei2 at lenovo.com
Fri Mar 24 02:55:39 UTC 2017


Hi

I'm a freshman in openstack. I want to contribute and learn some exciting by joining openstack. I will be grateful if anyone can help me on my starting process.

Now I encounter a problem when I tried the UT with tox.
I execute the following command,

(.venv-nova)[jiapei2 at localhost nova]$ tox -e py27 tests.unit.api.openstack.compute.test_server_action

And then I got the results:
=====
Totals
======
Ran: 136 tests in 51.0000 sec.
- Passed: 40
- Skipped: 0
- Expected Fail: 0
- Unexpected Success: 0
- Failed: 96
Sum of execute time for each test: 293.4456 sec.

One of the errors is like,
~~~~~~~~~~~~~~~~~~~~~~~
Captured pythonlogging:
~~~~~~~~~~~~~~~~~~~~~~~
    2017-03-24 10:25:17,374 ERROR [nova.api.openstack.extensions] Unexpected exception in API method
    Traceback (most recent call last):
      File "nova/api/openstack/extensions.py", line 478, in wrapped
        return f(*args, **kwargs)
      File "nova/api/openstack/compute/servers.py", line 882, in _action_revert_resize
        instance = self._get_server(context, req, id)
      File "nova/api/openstack/compute/servers.py", line 450, in _get_server
        expected_attrs=expected_attrs)
      File "nova/api/openstack/common.py", line 516, in get_instance
        expected_attrs=expected_attrs)
      File "nova/compute/api.py", line 2072, in get
        context, instance_id, expected_attrs=expected_attrs)
      File "/home/jiapei2/PycharmProjects/nova/.tox/py27/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 181, in wrapper
        result = fn(cls, context, *args, **kwargs)
      File "nova/objects/instance.py", line 399, in get_by_uuid
        use_slave=use_slave)
      File "nova/db/sqlalchemy/api.py", line 285, in wrapper
        return f(*args, **kwargs)
      File "nova/objects/instance.py", line 391, in _db_instance_get_by_uuid
        columns_to_join=columns_to_join)
      File "nova/tests/unit/api/openstack/fakes.py", line 358, in _return_server
        return stub_instance(1, **kwargs)
      File "nova/tests/unit/api/openstack/fakes.py", line 484, in stub_instance
        instance_type = flavors.get_default_flavor()
      File "nova/compute/flavors.py", line 206, in get_default_flavor
        return get_flavor_by_name(name)
      File "nova/compute/flavors.py", line 217, in get_flavor_by_name
        return objects.Flavor.get_by_name(ctxt, name)
      File "/home/jiapei2/PycharmProjects/nova/.tox/py27/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 181, in wrapper
        result = fn(cls, context, *args, **kwargs)
      File "nova/objects/flavor.py", line 139, in get_by_name
        db_flavor = db.flavor_get_by_name(context, name)
      File "nova/db/api.py", line 1507, in flavor_get_by_name
        return IMPL.flavor_get_by_name(context, name)
      File "nova/db/sqlalchemy/api.py", line 229, in wrapper
        return f(*args, **kwargs)
      File "/home/jiapei2/PycharmProjects/nova/.tox/py27/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 709, in wrapper
        return fn(*args, **kwargs)
      File "nova/db/sqlalchemy/api.py", line 5105, in flavor_get_by_name
        raise exception.FlavorNotFoundByName(flavor_name=name)
    FlavorNotFoundByName: Flavor with name m1.small could not be found.


Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "nova/tests/unit/api/openstack/compute/test_server_actions.py", line 890, in test_revert_resize_server
        body=body)
      File "nova/api/openstack/extensions.py", line 504, in wrapped
       raise webob.exc.HTTPInternalServerError(explanation=msg)
    webob.exc.HTTPInternalServerError: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
    <class 'nova.exception.FlavorNotFoundByName'>
~~~~~~~~~~~~~~~~~~~~

Is there anyting wrong with my configurations or procedures? I didn't change any code and just run "tox".
Any advice will be much appreciated.


Thanks and regards,
Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20170324/7e2b9918/attachment.html>


More information about the Openstack mailing list