]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Do not assume order of pci slot list
authorPritesh Kothari <pritesh.kothari@cisco.com>
Mon, 4 Aug 2014 21:14:20 +0000 (14:14 -0700)
committerpritesh <pritesh.kothari@cisco.com>
Thu, 7 Aug 2014 16:41:57 +0000 (16:41 +0000)
This fixes the neutron.tests.unit.sriovnicagent.test_eswitch_manager
.TestEmbSwitch.test_get_pci_list unit test that breaks with a
randomized PYTHONHASHSEED (see the bug report).

The test assumed that the pci slot list was sorted, so sort
the result before comparing.

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: Ia2d879cc1251fb9cf9b653a41064e902b30005af
Partial-bug: #1348818

neutron/tests/unit/sriovnicagent/test_eswitch_manager.py

index a7c41e3af1ddfcc016542d9decce823dd9766129..9823fb8e01cefdbf9eea6e532c90531798c5435a 100644 (file)
@@ -280,7 +280,8 @@ class TestEmbSwitch(base.BaseTestCase):
 
     def test_get_pci_list(self):
         result = self.emb_switch.get_pci_slot_list()
-        self.assertEqual([tup[0] for tup in self.SCANNED_DEVICES], result)
+        self.assertEqual([tup[0] for tup in self.SCANNED_DEVICES],
+                         sorted(result))
 
 
 class TestPciOsWrapper(base.BaseTestCase):