diff --git a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py index 2c9e8c84d20..23d889f2da0 100644 --- a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py +++ b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py @@ -7727,9 +7727,8 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver): common, self.volume, self.connector_multipath_enabled) - # On Python 3, hash is randomized, and so set() is used to get - # the expected order - fcwwns = list(set(('123456789054321', '123456789012345'))) + + fcwwns = ['123456789054321', '123456789012345'] expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), mock.call.getCPG(HPE3PAR_CPG), @@ -7737,10 +7736,21 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver): mock.call.queryHost(wwns=['123456789012345', '123456789054321']), mock.call.modifyHost('fakehost', - {'FCWWNs': fcwwns, + {'FCWWNs': mock.ANY, 'pathOperation': 1}), mock.call.getHost('fakehost')] + # We don't know what order fcwwns is supplied in. Since + # there are only two members, test it both ways. + call1 = mock.call('fakehost', {'FCWWNs': fcwwns, + 'pathOperation': 1}) + fcwwns_rev = list(fcwwns) + fcwwns_rev.reverse() + call2 = mock.call('fakehost', {'FCWWNs': fcwwns_rev, + 'pathOperation': 1}) + self.assertTrue(call1 in mock_client.modifyHost.call_args_list or + call2 in mock_client.modifyHost.call_args_list) + mock_client.assert_has_calls(expected) self.assertEqual(self.FAKE_HOST, host['name'])