From: Eric Harney Date: Mon, 30 Mar 2015 19:45:39 +0000 (-0400) Subject: Tests: Fix v6000 test failure with random hash seed X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5bb63eb0874ab642866c3805ce7b10b0149d65eb;p=openstack-build%2Fcinder-build.git Tests: Fix v6000 test failure with random hash seed If PYTHONHASHSEED is set to a non-zero value, this test will fail due to a dependency on dict ordering. Rework the test to handle randomly ordered dictionaries. Partial-Bug: #1348818 Change-Id: I92e780db5805e59ac9eef98a07cfbb7a4be54110 --- diff --git a/cinder/tests/test_v6000_fcp.py b/cinder/tests/test_v6000_fcp.py index a1d66cc8e..02fe11bb9 100644 --- a/cinder/tests/test_v6000_fcp.py +++ b/cinder/tests/test_v6000_fcp.py @@ -428,7 +428,6 @@ class V6000FCPDriverTestCase(test.TestCase): def test_build_initiator_target_map(self): """Successfully build a map when zoning is enabled.""" expected_targ_wwns = FC_TARGET_WWPNS - expected_init_targ_map = FC_INITIATOR_TARGET_MAP self.driver.lookup_service = mock.Mock() self.driver.lookup_service.get_device_mapping_from_network.\ @@ -440,7 +439,18 @@ class V6000FCPDriverTestCase(test.TestCase): self.driver.lookup_service.get_device_mapping_from_network.\ assert_called_with(CONNECTOR['wwpns'], self.driver.gateway_fc_wwns) self.assertEqual(set(expected_targ_wwns), set(targ_wwns)) - self.assertEqual(expected_init_targ_map, init_targ_map) + + i = FC_INITIATOR_WWPNS[0] + self.assertIn(FC_TARGET_WWPNS[0], init_targ_map[i]) + self.assertIn(FC_TARGET_WWPNS[1], init_targ_map[i]) + self.assertEqual(2, len(init_targ_map[i])) + + i = FC_INITIATOR_WWPNS[1] + self.assertIn(FC_TARGET_WWPNS[2], init_targ_map[i]) + self.assertIn(FC_TARGET_WWPNS[3], init_targ_map[i]) + self.assertEqual(2, len(init_targ_map[i])) + + self.assertEqual(2, len(init_targ_map)) def test_build_initiator_target_map_no_lookup_service(self): """Successfully build a map when zoning is disabled."""