Stevedore error while running unit tests

Bug #1372950 reported by Denis M.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack DBaaS (Trove)
Fix Released
Medium
Boden R

Bug Description

Stevedore error while running unit tests

Steps-to-reproduce:
1. Clone master branch.
2. Setup env by running tools/install_env.py
3. Run .venv/bin/python2.7 setup.py testr --slowest

Among all possible exceptions this one comes first.
Also take a look at:
 - https://bugs.launchpad.net/trove/+bug/1302784
 - https://bugs.launchpad.net/trove/+bug/1372895

(.venv)dmakogon@dmakogon-pc:~/Documents/Trove/repo/debia_build$ .venv/bin/python2.7 setup.py testr --slowest
running testr
running=${PYTHON:-python} -m subunit.run discover ./trove/tests/unittests --list
running=${PYTHON:-python} -m subunit.run discover ./trove/tests/unittests --load-list /tmp/tmpzbjkVk
running=${PYTHON:-python} -m subunit.run discover ./trove/tests/unittests --load-list /tmp/tmprw2u_p
running=${PYTHON:-python} -m subunit.run discover ./trove/tests/unittests --load-list /tmp/tmp50I_Dh
running=${PYTHON:-python} -m subunit.run discover ./trove/tests/unittests --load-list /tmp/tmpLovwZB
======================================================================
FAIL: api.common.test_extensions.TestExtensionLoading.test_default_extensions
tags: worker-3
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dmakogon/Documents/Trove/repo/debia_build/trove/tests/unittests/api/common/test_extensions.py", line 75, in test_default_extensions
    extension_mgr = extensions.ExtensionManager()
  File "trove/common/extensions.py", line 354, in __init__
    self._load_all_extensions()
  File "trove/common/extensions.py", line 414, in _load_all_extensions
    self.api_extension_manager.map(self.add_extension)
  File "/home/dmakogon/Documents/Trove/repo/debia_build/.venv/local/lib/python2.7/site-packages/stevedore/extension.py", line 214, in map
    raise RuntimeError('No %s extensions found' % self.namespace)
RuntimeError: No trove.api.extensions extensions found
======================================================================
FAIL: api.common.test_extensions.TestExtensionLoading.test_invalid_extension
tags: worker-1
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dmakogon/Documents/Trove/repo/debia_build/.venv/local/lib/python2.7/site-packages/mock.py", line 1201, in patched
    return func(*args, **keywargs)
  File "/home/dmakogon/Documents/Trove/repo/debia_build/trove/tests/unittests/api/common/test_extensions.py", line 85, in test_invalid_extension
    extension_mgr = extensions.ExtensionManager()
  File "trove/common/extensions.py", line 354, in __init__
    self._load_all_extensions()
  File "trove/common/extensions.py", line 414, in _load_all_extensions
    self.api_extension_manager.map(self.add_extension)
  File "/home/dmakogon/Documents/Trove/repo/debia_build/.venv/local/lib/python2.7/site-packages/stevedore/extension.py", line 214, in map
    raise RuntimeError('No %s extensions found' % self.namespace)
RuntimeError: No trove.api.extensions extensions found
======================================================================

Denis M. (dmakogon)
description: updated
Revision history for this message
Boden R (boden) wrote :

I just tried using the following steps:

- clone trove master
- cd trove
- tox -epy27
- everything is successful and if I grep the subunit log I find -->

tags: -worker-1
time: 2014-09-24 16:20:24.247910Z
tags: worker-0
test: api.common.test_extensions.TestExtensionLoading.test_default_extensions
time: 2014-09-24 16:20:24.284591Z
successful: api.common.test_extensions.TestExtensionLoading.test_default_extensions [ multipart
]

Whats in your trove.egg-info/entry_points.txt ? Does it have the trove.api.extensions entry point defined?

Revision history for this message
Denis M. (dmakogon) wrote :

I'm not running tox. See steps to reproduce. I'm running testr test directly. That's what Debian package maintainers do.
Please try mine steps-to-reproduce. And you'll see this issue.

Revision history for this message
Boden R (boden) wrote :

stevedore looks for the entry points which are exposed via the entry_points.txt in the egg dir for trove... That said if you install trove into your venv before trying to run the tests it should work...

so in your steps above add a step between 2-3:

2.5) source .venv/bin/activate && python setup.py install

When I did this and ran 'python setup.py testr --slowest' (in my venv) I didn't get the api test error, but I did get some other UTs ; those you refer to above.

Revision history for this message
Denis M. (dmakogon) wrote :

Boden, you missing the whole point.
From platform package maintainers point of view - when building package we just need to run unit tests without installing whole project.
Just to be clear, try to run test suit within tox by exclude int-tests part. And you'll see the issue.
Steps:
clone
build env
run testr

Thats all. For me it looks like a bug because of incorrect mocking and expecting that Trove is installed into the system(which actually tox does for its own env) which is wrong from developers point of view.

Revision history for this message
Boden R (boden) wrote :

Denis - I'll mock this one out.

Changed in trove:
assignee: nobody → Boden R (boden)
Boden R (boden)
Changed in trove:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to trove (master)

Fix proposed to branch: master
Review: https://review.openstack.org/124029

Denis M. (dmakogon)
Changed in trove:
importance: Undecided → Medium
Changed in trove:
milestone: ongoing → kilo-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to trove (master)

Reviewed: https://review.openstack.org/124029
Committed: https://git.openstack.org/cgit/openstack/trove/commit/?id=9417746a3810135033453e4b4a7a7784ca85afb7
Submitter: Jenkins
Branch: master

commit 9417746a3810135033453e4b4a7a7784ca85afb7
Author: Boden R <email address hidden>
Date: Thu Sep 25 08:04:24 2014 -0400

    Complete mocking for test_extensions

    The current implementation of trove.tests.unittests.api.
    common.test_extensions does not fully mock the
    test_default_extensions method. As a result trove UTs run without
    trove being installed fail in this method as it assumes the
    entry points have been installed into the egg for trove.

    This patch completes mocking of that method so that the
    test_extensions class can be run in a UT environment in
    which trove is not installed and thus may not have the entry
    points installed to the egg.

    Change-Id: I2543f17fe087cf98d1a11ef47a07b4addfd32cd4
    Closes-Bug: 1372950

Changed in trove:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in trove:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in trove:
milestone: kilo-1 → 2015.1.0
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.