Specify UUIDs in VIOS mocks for FeedTasks
This is a weird one. Bear with me. A change in oslotest [1] introduced some mock classes with underscores. This was harmless until nova started using them (indirectly) [2]. The effect was that str()s of mocked attributes could now contain underscores, which they didn't previously. There's one line of pypowervm code [3] that's splitting on underscore in such a way that this new underscore broke six of the nova-powervm unit tests with symptoms like: File "/home/zuul/src/git.openstack.org/openstack/nova-powervm/.tox/py27/local/lib/python2.7/site-packages/pypowervm/utils/transaction.py", line 745, in _process_subtask_rets wrapper=subtask_rets['wrapper_%s' % uuid]) KeyError: "wrapper_AutospecMock name='mock.uuid' id='139651774598224'>" An oslotest patch [4] has been proposed to remove the underscores. But the other solution (this patch) was for us to find those pesky mocked attributes and put real strings in 'em, to avoid that underscore altogether. [1] I0e4a55fbf4c1d175726ca22b664e240849a99856 [2] I3636833962c905faa0f144c7fdc4833037324d31 [3] https://github.com/powervm/pypowervm/blob/release/1.1.13/pypowervm/utils/transaction.py#L742 [4] I0e0bb5629f63ec18af27b26cb5675ff88f041c00 Change-Id: Icaa125418a2590103147572212978b3d850aa4dd
This commit is contained in:
parent
212daa6868
commit
b925fcba37
|
@ -80,7 +80,7 @@ class TestSSPDiskAdapter(test.NoDBTestCase):
|
|||
self.clust_wrap = mock.Mock(spec=pvm_clust.Cluster,
|
||||
nodes=[self.node1, self.node2])
|
||||
self.clust_wrap.refresh.return_value = self.clust_wrap
|
||||
self.vio_wrap = mock.Mock(spec=pvm_vios.VIOS)
|
||||
self.vio_wrap = mock.Mock(spec=pvm_vios.VIOS, uuid='uuid')
|
||||
|
||||
# For _fetch_cluster() with no name
|
||||
self.mock_clust_get = self.sspfx.mock_clust_get
|
||||
|
|
|
@ -157,8 +157,8 @@ class TestPowerVMDriver(test.NoDBTestCase):
|
|||
self.build_tx_feed = self.useFixture(fixtures.MockPatch(
|
||||
'pypowervm.tasks.partition.build_active_vio_feed_task')).mock
|
||||
|
||||
self.stg_ftsk = pvm_tx.FeedTask('fake',
|
||||
[mock.Mock(spec=pvm_vios.VIOS)])
|
||||
self.stg_ftsk = pvm_tx.FeedTask(
|
||||
'fake', [mock.Mock(spec=pvm_vios.VIOS, uuid='uuid')])
|
||||
self.build_tx_feed.return_value = self.stg_ftsk
|
||||
|
||||
self.scrub_stg = self.useFixture(fixtures.MockPatch(
|
||||
|
|
Loading…
Reference in New Issue