From b0f68bb14531b74f54cad6106491ff75b0e8a1d8 Mon Sep 17 00:00:00 2001 From: Pritesh Kothari Date: Mon, 4 Aug 2014 14:14:20 -0700 Subject: [PATCH] Do not assume order of pci slot list 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neutron/tests/unit/sriovnicagent/test_eswitch_manager.py b/neutron/tests/unit/sriovnicagent/test_eswitch_manager.py index a7c41e3af..9823fb8e0 100644 --- a/neutron/tests/unit/sriovnicagent/test_eswitch_manager.py +++ b/neutron/tests/unit/sriovnicagent/test_eswitch_manager.py @@ -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): -- 2.45.2