[openstack-dev] [heat][oslo] heat unit tests mocking private parts of oslo.messaging
Doug Hellmann
doug at doughellmann.com
Mon Jan 5 23:03:20 UTC 2015
As part of updating oslo.messaging to move it out of the oslo namespace package I ran into some issues with heat. While debugging, I tried running the heat unit tests using the modified version of oslo.messaging and ran into test failures because the tests are mocking private parts of the library that are moving to have new names.
Mocking internal parts of Oslo libraries isn’t supported, and so I need someone from the heat team to work with me to fix the heat tests and possibly add missing fixtures to oslo.messaging to avoid breaking heat when we release the updated oslo.messaging. I tried raising attention on IRC in #heat but I think I’m in the wrong timezone compared to most of the heat devs.
Here’s an example of one of the failing tests:
======================================================================
FAIL: heat.tests.test_stack_lock.StackLockTest.test_failed_acquire_existing_lock_engine_alive
tags: worker-3
----------------------------------------------------------------------
Traceback (most recent call last):
File "heat/tests/test_stack_lock.py", line 84, in test_failed_acquire_existing_lock_engine_alive
self.m.StubOutWithMock(messaging.rpc.client._CallContext, "call")
AttributeError: 'module' object has no attribute '_CallContext'
Traceback (most recent call last):
_StringException: Empty attachments:
pythonlogging:'alembic'
pythonlogging:'cliff'
pythonlogging:'heat-provision'
pythonlogging:'heat_integrationtests'
pythonlogging:'heatclient'
pythonlogging:'iso8601'
pythonlogging:'keystoneclient'
pythonlogging:'migrate'
pythonlogging:'neutronclient'
pythonlogging:'novaclient'
pythonlogging:'oslo'
pythonlogging:'oslo_config'
pythonlogging:'oslo_messaging'
pythonlogging:'requests'
pythonlogging:'routes'
pythonlogging:'saharaclient'
pythonlogging:'sqlalchemy'
pythonlogging:'stevedore'
pythonlogging:'swiftclient'
pythonlogging:'troveclient'
pythonlogging:'': {{{WARNING [heat.engine.environment] Changing AWS::CloudWatch::Alarm from OS::Heat::CWLiteAlarm to OS::Heat::CWLiteAlarm}}}
Traceback (most recent call last):
File "heat/tests/test_stack_lock.py", line 84, in test_failed_acquire_existing_lock_engine_alive
self.m.StubOutWithMock(messaging.rpc.client._CallContext, "call")
AttributeError: 'module' object has no attribute '_CallContext'
Traceback (most recent call last):
_StringException: Empty attachments:
pythonlogging:'alembic'
pythonlogging:'cliff'
pythonlogging:'heat-provision'
pythonlogging:'heat_integrationtests'
pythonlogging:'heatclient'
pythonlogging:'iso8601'
pythonlogging:'keystoneclient'
pythonlogging:'migrate'
pythonlogging:'neutronclient'
pythonlogging:'novaclient'
pythonlogging:'oslo'
pythonlogging:'oslo_config'
pythonlogging:'oslo_messaging'
pythonlogging:'requests'
pythonlogging:'routes'
pythonlogging:'saharaclient'
pythonlogging:'sqlalchemy'
pythonlogging:'stevedore'
pythonlogging:'swiftclient'
pythonlogging:'troveclient'
pythonlogging:'': {{{WARNING [heat.engine.environment] Changing AWS::CloudWatch::Alarm from OS::Heat::CWLiteAlarm to OS::Heat::CWLiteAlarm}}}
Traceback (most recent call last):
File "heat/tests/test_stack_lock.py", line 84, in test_failed_acquire_existing_lock_engine_alive
self.m.StubOutWithMock(messaging.rpc.client._CallContext, "call")
AttributeError: 'module' object has no attribute ‘_CallContext'
That class _CallContext isn’t part of the public API for oslo.messaging, and so it is not being exposed through the redirect modules I’m creating for backwards compatibility. We need to look for a way to create a fixture to do whatever it is these tests are trying to do — I don’t understand the tests, which is why I need a heat developer to help out.
Doug
More information about the OpenStack-dev
mailing list