From 405cd378232df5be383b3f3aac61869459542e52 Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Thu, 4 Jan 2018 11:38:32 -0500 Subject: [PATCH] Tests: Fix XIV test failure with hash randomization _get_fc_targets creates a set() from target_wwpns. It then sorts the contents of that set using a comparison that only checks the last digit of the entry. This is not a stable sort, so the order of the list output from _get_fc_targets is non-deterministic. This appears to be fine in practice, so just fix the unit test. Needed-By: I4c7396f9d8e58ac8420754503f8ed60cd7473426 Change-Id: I281ad59fa518f936aa8d1b518acf61800ba949f5 --- cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py b/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py index 152bcf55fb8..0f2d9606dde 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py @@ -1439,8 +1439,9 @@ class XIVProxyTest(test.TestCase): p.ibm_storage_cli.cmd.host_connectivity_list.return_value = ( HOST_CONNECTIVITY_LIST) fc_targets = p._get_fc_targets(host) - self.assertEqual(FC_TARGETS_OPTIMIZED_WITH_HOST, fc_targets, - "FC targets are different from the expected") + six.assertCountEqual(self, + FC_TARGETS_OPTIMIZED_WITH_HOST, fc_targets, + "FC targets are different from the expected") def test_get_fc_targets_returns_host_all_wwpns_list(self): driver = mock.MagicMock() @@ -1459,8 +1460,9 @@ class XIVProxyTest(test.TestCase): p.ibm_storage_cli.cmd.host_connectivity_list.return_value = ( HOST_CONNECTIVITY_LIST_UNKNOWN_HOST) fc_targets = p._get_fc_targets(host) - self.assertEqual(FC_TARGETS_OPTIMIZED, fc_targets, - "FC targets are different from the expected") + six.assertCountEqual(self, + FC_TARGETS_OPTIMIZED, fc_targets, + "FC targets are different from the expected") def test_define_ports_returns_sorted_wwpns_list(self): driver = mock.MagicMock()