From 9d2ce8f1fe57c1d1e4109922d1d9f7d608877bd5 Mon Sep 17 00:00:00 2001 From: Sergey Nikitin Date: Tue, 25 Oct 2016 17:42:37 +0300 Subject: [PATCH] Changed NUMACell to InstanceNUMACell in test_stats.py Tested methods consume_requests() and consume_requests() operate with InstanceNUMACell objects but because of mistake NUMACell objects were used instead. It may cause the problem if these methods will try to use some field which is not a field of NUMACell but is a field of InstanceNUMACell. Also some indents were removed from assertTrue/False Change-Id: Ib41c9b22bfd22e769fac729f09d95d6bc8ba8e6b --- nova/tests/unit/pci/test_stats.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/nova/tests/unit/pci/test_stats.py b/nova/tests/unit/pci/test_stats.py index ae29842d5a31..6257ecf7b75b 100644 --- a/nova/tests/unit/pci/test_stats.py +++ b/nova/tests/unit/pci/test_stats.py @@ -169,37 +169,34 @@ class PciDeviceStatsTestCase(test.NoDBTestCase): pci_requests_multiple)) def test_support_requests_numa(self): - cells = [objects.NUMACell(id=0, cpuset=set(), memory=0), - objects.NUMACell(id=1, cpuset=set(), memory=0)] - self.assertTrue(self.pci_stats.support_requests( - pci_requests, cells)) + cells = [objects.InstanceNUMACell(id=0, cpuset=set(), memory=0), + objects.InstanceNUMACell(id=1, cpuset=set(), memory=0)] + self.assertTrue(self.pci_stats.support_requests(pci_requests, cells)) def test_support_requests_numa_failed(self): - cells = [objects.NUMACell(id=0, cpuset=set(), memory=0)] - self.assertFalse(self.pci_stats.support_requests( - pci_requests, cells)) + cells = [objects.InstanceNUMACell(id=0, cpuset=set(), memory=0)] + self.assertFalse(self.pci_stats.support_requests(pci_requests, cells)) def test_support_requests_no_numa_info(self): - cells = [objects.NUMACell(id=0, cpuset=set(), memory=0)] + cells = [objects.InstanceNUMACell(id=0, cpuset=set(), memory=0)] pci_request = [objects.InstancePCIRequest(count=1, spec=[{'vendor_id': 'v3'}])] - self.assertTrue(self.pci_stats.support_requests( - pci_request, cells)) + self.assertTrue(self.pci_stats.support_requests(pci_request, cells)) def test_consume_requests_numa(self): - cells = [objects.NUMACell(id=0, cpuset=set(), memory=0), - objects.NUMACell(id=1, cpuset=set(), memory=0)] + cells = [objects.InstanceNUMACell(id=0, cpuset=set(), memory=0), + objects.InstanceNUMACell(id=1, cpuset=set(), memory=0)] devs = self.pci_stats.consume_requests(pci_requests, cells) self.assertEqual(2, len(devs)) self.assertEqual(set(['v1', 'v2']), set([dev.vendor_id for dev in devs])) def test_consume_requests_numa_failed(self): - cells = [objects.NUMACell(id=0, cpuset=set(), memory=0)] + cells = [objects.InstanceNUMACell(id=0, cpuset=set(), memory=0)] self.assertIsNone(self.pci_stats.consume_requests(pci_requests, cells)) def test_consume_requests_no_numa_info(self): - cells = [objects.NUMACell(id=0, cpuset=set(), memory=0)] + cells = [objects.InstanceNUMACell(id=0, cpuset=set(), memory=0)] pci_request = [objects.InstancePCIRequest(count=1, spec=[{'vendor_id': 'v3'}])] devs = self.pci_stats.consume_requests(pci_request, cells)