Cannot run tests without virtual env

Bug #1197800 reported by Stuart McLaren
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
John Bresnahan

Bug Description

It looks like commit 039f3d8a59c62d3ad14288ed1b6a97aab539731e (Convert scripts to entry points)
means that it is no longer possible to run the tests with ./run_tests.sh -N (ie without a virtual environment).

If I checkout the previous commit (e4d142ed6b7dc80572d3c293c9300b9ee1c6b2fe) ./run_tests.sh -N works ok (once I've satisfied all the package dependencies).

However with 039f3d8a59c62d3ad14288ed1b6a97aab539731e the tests actually use the system commands if present (eg /usr/local/bin/glance-manage) or error out of the commands are not present, eg:

ERROR: glance.tests.functional.v1.test_api.TestApi.test_get_head_simple_post
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/home/sam/git/sync/glance/glance/tests/utils.py", line 124, in wrapped
    func(*a, **kwargs)
  File "/home/sam/git/sync/glance/glance/tests/functional/v1/test_api.py", line 66, in test_get_head_simple_post
    self.start_servers(**self.__dict__.copy())
  File "/home/sam/git/sync/glance/glance/tests/functional/__init__.py", line 734, in start_servers
    **kwargs)
  File "/home/sam/git/sync/glance/glance/tests/functional/__init__.py", line 702, in start_with_retry
    **kwargs)
  File "/home/sam/git/sync/glance/glance/tests/functional/__init__.py", line 140, in start
    self.create_database()
  File "/home/sam/git/sync/glance/glance/tests/functional/__init__.py", line 217, in create_database
    expect_exit=True)
  File "/home/sam/git/sync/glance/glance/tests/utils.py", line 271, in execute
    raise RuntimeError(msg)
RuntimeError: Command glance-manage --config-file /tmp/tmpeiYfco/etc/glance-manage.conf db_sync did not succeed. Returned an exit code of 127.

STDOUT:

STDERR: /bin/sh: 1: glance-manage: not found

The tests should be using the actual current glance code rather than depending on glance being available on the system.

Revision history for this message
Mark Washenberger (markwash) wrote :
Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

I think its part of the way there, but fails a bit later:

$ nosetests --tests=glance.tests.functional.v1.test_api:TestApi.test_get_head_simple_post
glance.tests.functional.v1.test_api.TestApi.test_get_head_simple_post ... FAIL

======================================================================
FAIL: glance.tests.functional.v1.test_api.TestApi.test_get_head_simple_post
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/home/ubuntu/git/glance/glance/tests/utils.py", line 124, in wrapped
    func(*a, **kwargs)
  File "/home/ubuntu/git/glance/glance/tests/functional/v1/test_api.py", line 66, in test_get_head_simple_post
    self.start_servers(**self.__dict__.copy())
  File "/home/ubuntu/git/glance/glance/tests/functional/__init__.py", line 735, in start_servers
    **kwargs)
  File "/home/ubuntu/git/glance/glance/tests/functional/__init__.py", line 716, in start_with_retry
    self.assertTrue(launch_msg is None, launch_msg)
AssertionError: Unexpected server launch status for: registry,
strace:

----------------------------------------------------------------------
Ran 1 test in 32.425s

We probably need the equivalent change for everything that was previously a script, eg glance-api/glance-registry/glance-cache-manage etc.

Changed in glance:
assignee: nobody → John Bresnahan (jbresnah)
status: New → Confirmed
Revision history for this message
John Bresnahan (jbresnah) wrote :

This does not seem ot be a problem anymore. In a clean Fedora VM I did the following:

git clone git://github.com/openstack/glance.git
virtualenv --no-site-packages VE
source VE/bin/activate
cd glance/
pip install -r requirements.txt
pip install -r test-requirements.txt
python setup.py develop
./run_tests.sh -N

And everything worked.

Stuart, can you please verify?

Revision history for this message
John Bresnahan (jbresnah) wrote :

For completeness I also did the following which works:

sudo -i
git clone git://github.com/openstack/glance.git
pip install -r requirements.txt
pip install -r test-requirements.txt
python setup.py install
exit

# <as regular user>
git clone git://github.com/openstack/glance.git
cd glance
./run-tests -N

Revision history for this message
John Bresnahan (jbresnah) wrote :

I appoligize, I think the title of this bug threw me off. I think what is desired is being able to run the tests without installing glance at all (to a VE or to a system installation). I am not sure why 'python setup.py develop' combined with a VE is a problem but this should be easy enough to fix.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
status: Confirmed → In Progress
Changed in glance:
importance: Undecided → Low
milestone: none → havana-3
Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

Hi John, many thanks for checking this out for me.

> I am not sure why 'python setup.py develop' combined with a VE is a problem but this should be easy enough to fix.

To give you some context ...

what we do is we have build machines which we want to resemble our production environment.

We have the build vm install the same set of packages which we will have on our production systems
and then do 'run_tests.sh -N'. We like to have the unit/functional tests run successfully on the same environment,
using the same packaged code which will be on the production node.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/42041
Committed: http://github.com/openstack/glance/commit/e3b54dd71d5a69720f2ee929f68e96ce8e2dfa56
Submitter: Jenkins
Branch: master

commit e3b54dd71d5a69720f2ee929f68e96ce8e2dfa56
Author: John Bresnahan <email address hidden>
Date: Wed Aug 14 15:10:55 2013 -1000

    Allow tests to run without installation

    This patch makes modifications to the way that programs which the various
    tests depend on are forked and executed. This will allow the tests to be
    run without installing glance to a python installation (ie: python setup.py
    {develop/install} will not be needed).

    fixes bug: 1197800

    Change-Id: I9687cb7a5b22747d9cea0a1c24057383a8901476

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Revision history for this message
Yang Yu (yuyangbj) wrote : I will be on vacation from 9/5 to 9/15, urgent call: 13811509950

I will be out of the office starting 2013-09-05 and will not return until
2013-09-15.

I will be on my marriage leave from 9/5 to 9/15, for any urgent issue
please call me before 9/7.

For daily work, please ask my scrum master Zhu Zhu for help.
For glance issue, please ask glance SME Feilong Wang for help.
For defect report, there will be no report next week.

Thierry Carrez (ttx)
Changed in glance:
milestone: havana-3 → 2013.2
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.