summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohndavidge <jodavidg@cisco.com>2014-08-08 04:48:59 -0700
committerJohn Davidge <jodavidg@cisco.com>2014-09-29 11:00:51 +0000
commit2abb77b4dadd4150f554f134ec99b07c2b28900f (patch)
tree98a785741a9fff7e904e3959de33810b6cc1d8c0
parentff9745c9527399df52f56b022a698cd63e48d537 (diff)
downloadneutron-2abb77b4dadd4150f554f134ec99b07c2b28900f.tar.gz
Do not assume order of report list elements
This fixes the test_report_multiple_services unit test that breaks with a randomized PYTHONHASHSEED (see the bug report). The test assumed that the report list from self.driver.report_status() had elements in a particular order. Found with PYTHONHASHSEED=2455351445. The fix refactors the test case to handle an unsorted report list by sorting it before checking equality. Partial-bug: #1348818 Note: There are several other unrelated unit tests that also break with a randomized PYTHONHASHSEED, but they are not addressed here. They will be addressed in separate patches. Change-Id: I542c3818821fa2f6e460fd254a3842530ecea8d9
-rw-r--r--neutron/tests/unit/services/vpn/device_drivers/test_cisco_ipsec.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/neutron/tests/unit/services/vpn/device_drivers/test_cisco_ipsec.py b/neutron/tests/unit/services/vpn/device_drivers/test_cisco_ipsec.py
index f08364894c..fe373055c6 100644
--- a/neutron/tests/unit/services/vpn/device_drivers/test_cisco_ipsec.py
+++ b/neutron/tests/unit/services/vpn/device_drivers/test_cisco_ipsec.py
@@ -14,6 +14,7 @@
import copy
import httplib
+import operator
import mock
@@ -1530,7 +1531,8 @@ class TestCiscoCsrIPsecDeviceDriverSyncStatuses(base.BaseTestCase):
u'4': {u'status': constants.ACTIVE,
u'updated_pending_status': True}}
}]
- self.assertEqual(expected_report, report)
+ self.assertEqual(expected_report,
+ sorted(report, key=operator.itemgetter('id')))
# Check that service and connection statuses are updated
self.assertEqual(constants.ACTIVE, vpn_service1.last_status)
self.assertEqual(constants.ACTIVE,