[openstack-dev] [heat][oslo] heat unit tests mocking private parts of oslo.messaging

Doug Hellmann doug at doughellmann.com
Tue Jan 6 00:31:38 UTC 2015


> On Jan 5, 2015, at 6:54 PM, Angus Salkeld <asalkeld at mirantis.com> wrote:
> 
> On Tue, Jan 6, 2015 at 9:03 AM, Doug Hellmann <doug at doughellmann.com> wrote:
> 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.
> 
> Hi Doug,
> 
> This should help you along: https://review.openstack.org/#/c/145094/

That looks good, thanks!

Doug

> 
> -Angus
>  
> 
> 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
> 
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev




More information about the OpenStack-dev mailing list