summaryrefslogtreecommitdiff
path: root/nova/tests/unit/pci/test_stats.py
diff options
context:
space:
mode:
authorMoshe Levi <moshele@mellanox.com>2015-03-27 14:19:24 +0300
committerMoshe Levi <moshele@mellanox.com>2015-04-20 23:49:32 +0300
commit0efc217ba00f49e4d51bafed54d483007a4d51c5 (patch)
tree44b150ace61334117c58d93f473e5a5b0ce65f70 /nova/tests/unit/pci/test_stats.py
parentdc06cf40c44eabcd99ad97486914515a839d2fc4 (diff)
downloadnova-0efc217ba00f49e4d51bafed54d483007a4d51c5.tar.gz
Add equality operators to PciDeviceStats and PciDevice objects
resources['pci_device_pools'] value is now PciDeviceStats object therefore when comparing this resource it is need equality operators to compare the inner content. the PciDeviceStats itself contain PciDevice objects, therefore equality operators need here as well. Closes-Bug: #1436986 Change-Id: Ib6f051dd65ad6960bba18052b49a9a678d3b3ae0
Diffstat (limited to 'nova/tests/unit/pci/test_stats.py')
-rw-r--r--nova/tests/unit/pci/test_stats.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/nova/tests/unit/pci/test_stats.py b/nova/tests/unit/pci/test_stats.py
index cfc9c3779c..8685415eb0 100644
--- a/nova/tests/unit/pci/test_stats.py
+++ b/nova/tests/unit/pci/test_stats.py
@@ -96,6 +96,21 @@ class PciDeviceStatsTestCase(test.NoDBTestCase):
self.pci_stats.remove_device,
self.fake_dev_2)
+ def test_pci_stats_equivalent(self):
+ pci_stats2 = stats.PciDeviceStats()
+ map(pci_stats2.add_device, [self.fake_dev_1,
+ self.fake_dev_2,
+ self.fake_dev_3,
+ self.fake_dev_4])
+ self.assertEqual(self.pci_stats, pci_stats2)
+
+ def test_pci_stats_not_equivalent(self):
+ pci_stats2 = stats.PciDeviceStats()
+ map(pci_stats2.add_device, [self.fake_dev_1,
+ self.fake_dev_2,
+ self.fake_dev_3])
+ self.assertNotEqual(self.pci_stats, pci_stats2)
+
def test_object_create(self):
m = objects.pci_device_pool.from_pci_stats(self.pci_stats.pools)
new_stats = stats.PciDeviceStats(m)