hpe3par unit tests leak data between tests

Bug #1750412 reported by Eric Harney
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Invalid
Undecided
Unassigned

Bug Description

I've seen failures like the following, locally and on zuul.

These tests seem to store test state in "self", causing mocks to leak between tests and randomly break.

cinder.tests.unit.volume.drivers.hpe.test_hpe3par.TestHPE3PARFCDriver.test_create_modify_host
---------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/home/eharney/src/cinder-review5/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py", line 7744, in test_create_modify_host'
    b' mock_client.assert_has_calls(expected)'
    b' File "/home/eharney/src/cinder-review5/.tox/py35/lib/python3.5/site-packages/mock/mock.py", line 969, in assert_has_calls'
    b' ), cause)'
    b' File "<string>", line 3, in raise_from'
    b'AssertionError: Calls not found.'
    b"Expected: [call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'),"
    b" call.getCPG('OpenStackCPG'),"
    b" call.getHost('fakehost'),"
    b" call.queryHost(wwns=['123456789012345', '123456789054321']),"
    b" call.modifyHost('fakehost', {'FCWWNs': ['123456789054321', '123456789012345'], 'pathOperation': 1}),"
    b" call.getHost('fakehost')]"
    b'Actual: [call.getWsApiVersion(),'
    b" call.login('testUser', 'testPassword'),"
    b" call.setSSHOptions('2.2.2.2', 'testUser', 'testPassword', conn_timeout=44, known_hosts_file='/home/eharney/src/cinder-review5/ssh_known_hosts', missing_key_policy='AutoAddPolicy', port=999, privatekey='foobar'),"
    b' call.getStorageSystemInfo(),'
    b" call.getStorageSystemInfo().__getitem__('id'),"
    b' call.getStorageSystemInfo().__getitem__().__str__(),'
    b' call.logout(),'
    b" call.login('testUser', 'testPassword'),"
    b" call.setSSHOptions('2.2.2.2', 'testUser', 'testPassword', conn_timeout=44, known_hosts_file='/home/eharney/src/cinder-review5/ssh_known_hosts', missing_key_policy='AutoAddPolicy', port=999, privatekey='foobar'),"
    b" call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'),"
    b" call.getCPG('OpenStackCPG'),"
    b" call.getHost('fakehost'),"
    b" call.queryHost(wwns=['123456789012345', '123456789054321']),"
    b" call.modifyHost('fakehost', {'FCWWNs': ['123456789012345', '123456789054321'], 'pathOperation': 1}),"
    b" call.getHost('fakehost')]"
    b''

ft1.5: cinder.tests.unit.volume.drivers.hpe.test_hpe3par.TestHPE3PARFCDriver.test_create_modify_hosttesttools.testresult.real._StringException: Traceback (most recent call last):
  File "/home/zuul/src/git.openstack.org/openstack/cinder/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py", line 7744, in test_create_modify_host
    mock_client.assert_has_calls(expected)
  File "/home/zuul/src/git.openstack.org/openstack/cinder/.tox/py35/lib/python3.5/site-packages/mock/mock.py", line 969, in assert_has_calls
    ), cause)
  File "<string>", line 3, in raise_from
AssertionError: Calls not found.
Expected: [call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'),
 call.getCPG('OpenStackCPG'),
 call.getHost('fakehost'),
 call.queryHost(wwns=['123456789012345', '123456789054321']),
 call.modifyHost('fakehost', {'FCWWNs': ['123456789054321', '123456789012345'], 'pathOperation': 1}),
 call.getHost('fakehost')]
Actual: [call.getWsApiVersion(),
 call.login('testUser', 'testPassword'),
 call.setSSHOptions('2.2.2.2', 'testUser', 'testPassword', conn_timeout=44, known_hosts_file='/home/zuul/src/git.openstack.org/openstack/cinder/ssh_known_hosts', missing_key_policy='AutoAddPolicy', port=999, privatekey='foobar'),
 call.getStorageSystemInfo(),
 call.getStorageSystemInfo().__getitem__('id'),
 call.getStorageSystemInfo().__getitem__().__str__(),
 call.logout(),
 call.login('testUser', 'testPassword'),
 call.setSSHOptions('2.2.2.2', 'testUser', 'testPassword', conn_timeout=44, known_hosts_file='/home/zuul/src/git.openstack.org/openstack/cinder/ssh_known_hosts', missing_key_policy='AutoAddPolicy', port=999, privatekey='foobar'),
 call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'),
 call.getCPG('OpenStackCPG'),
 call.getHost('fakehost'),
 call.queryHost(wwns=['123456789012345', '123456789054321']),
 call.modifyHost('fakehost', {'FCWWNs': ['123456789012345', '123456789054321'], 'pathOperation': 1}),
 call.getHost('fakehost')]

Tags: 3par hpe tests
Revision history for this message
Eric Harney (eharney) wrote :

The tests don't leak calls between tests -- they just have a bunch of calls that aren't checked.

The actual failure is more hash randomization issues, will add that to the pile of fixes for that bug.

Changed in cinder:
status: New → Invalid
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.