tests fail when OS_REGION_NAME env var is set

Bug #1308029 reported by Hugh Saunders
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rally
Fix Released
Medium
Hugh Saunders

Bug Description

Expected behaviour: Tests are stable regardless of user environment
Actual Behaviour: tests.cmd.commands.test_deployment.DeploymentCommandsTestCase.test_createfromenv fails when OS_REGION_NAME is set.

Example, Failure with OS_REGION_NAME set:

cb 0 (py27) [master cf81d7c] ~/git/rally
$ python -m unittest tests.cmd.commands.test_deployment.DeploymentCommandsTestCase.test_createfromenv
+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+--------+
| uuid | created_at | name | status | active |
+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+--------+
| <MagicMock name='create_deploy().__getitem__()' id='57513168'> | <MagicMock name='create_deploy().__getitem__()' id='57513168'> | <MagicMock name='create_deploy().__getitem__()' id='57513168'> | <MagicMock name='create_deploy().__getitem__()' id='57513168'> | |
+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+--------+
F
======================================================================
FAIL: test_createfromenv (tests.cmd.commands.test_deployment.DeploymentCommandsTestCase)
tests.cmd.commands.test_deployment.DeploymentCommandsTestCase.test_createfromenv
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/home/hugh/git/rally/.tox/py27/local/lib/python2.7/site-packages/mock.py", line 1618, in _inner
    return f(*args, **kw)
  File "/home/hugh/git/rally/.tox/py27/local/lib/python2.7/site-packages/mock.py", line 1201, in patched
    return func(*args, **keywargs)
  File "tests/cmd/commands/test_deployment.py", line 57, in test_createfromenv
    'from_env'
  File "/home/hugh/git/rally/.tox/py27/local/lib/python2.7/site-packages/mock.py", line 846, in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
  File "/home/hugh/git/rally/.tox/py27/local/lib/python2.7/site-packages/mock.py", line 835, in assert_called_with
    raise AssertionError(msg)
AssertionError: Expected call: create_deploy({'endpoint': {'username': 'fake_username', 'tenant_name': 'fake_tenant_name', 'password': 'fake_password', 'auth_url': 'fake_auth_url'}, 'name': 'ExistingCloud'}, 'from_env')
Actual call: create_deploy({'endpoint': {'username': 'fake_username', 'tenant_name': 'fake_tenant_name', 'password': 'fake_password', 'auth_url': 'fake_auth_url', 'region_name': 'LON'}, 'name': 'ExistingCloud'}, 'from_env')

----------------------------------------------------------------------
Ran 1 test in 0.006s

FAILED (failures=1)
cb 0 (py27) [master cf81d7c] ~/git/rally

Success after unsetting OS_REGION_NAME:

$ unset OS_REGION_NAME
cb 0 (py27) [master cf81d7c] ~/git/rally
$ python -m unittest tests.cmd.commands.test_deployment.DeploymentCommandsTestCase.test_createfromenv
+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+--------+
| uuid | created_at | name | status | active |
+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+--------+
| <MagicMock name='create_deploy().__getitem__()' id='68981968'> | <MagicMock name='create_deploy().__getitem__()' id='68981968'> | <MagicMock name='create_deploy().__getitem__()' id='68981968'> | <MagicMock name='create_deploy().__getitem__()' id='68981968'> | |
+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+--------+
.
----------------------------------------------------------------------
Ran 1 test in 0.004s

OK

Changed in rally:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Hugh Saunders (hughsaunders)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to rally (master)

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

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to rally (master)

Reviewed: https://review.openstack.org/87586
Committed: https://git.openstack.org/cgit/stackforge/rally/commit/?id=3ab1e85cf64a121cc94ceb0984890766ea8af919
Submitter: Jenkins
Branch: master

commit 3ab1e85cf64a121cc94ceb0984890766ea8af919
Author: Hugh Saunders <email address hidden>
Date: Tue Apr 15 12:30:50 2014 +0000

    Remove createfromenv test environment dependency

    The createfromenv deployment function uses the environment variable
    OS_REGION_NAME, but the tests did not correctly mock this variable.
    Consequently setting this env var before running tests would cause the
    tests to fail. This patch corrects the mock.

    Change-Id: I15fe174cd9700ff34791c6980fa52ff975055e02
    Closes-Bug: #1308029

Changed in rally:
status: In Progress → Fix Committed
Changed in rally:
status: Fix Committed → Fix Released
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.