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
Fix proposed to branch: master /review. openstack. org/87586
Review: https:/