summaryrefslogtreecommitdiff
path: root/nova/tests/unit/test_notifications.py
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2020-08-31 17:27:18 +0100
committerStephen Finucane <stephenfin@redhat.com>2020-11-24 15:29:21 +0000
commit9d1683f70f2c11c3c866ff457aa23a7a38421afe (patch)
tree91ee65567d96b06d13eb8bb1240a3b137eb13503 /nova/tests/unit/test_notifications.py
parent68bc87876f6479fe49b6a13a4c032eefe0ff016f (diff)
downloadnova-9d1683f70f2c11c3c866ff457aa23a7a38421afe.tar.gz
virt: Remove 'get_all_bw_counters' API
This one is a little more involved because there are persistent objects and versioned notifications to worry about, neither of which we can remove right now. Change-Id: Ic7c330ee1cccdc44a2a555c16cb6090eecbf6ce1 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'nova/tests/unit/test_notifications.py')
-rw-r--r--nova/tests/unit/test_notifications.py28
1 files changed, 4 insertions, 24 deletions
diff --git a/nova/tests/unit/test_notifications.py b/nova/tests/unit/test_notifications.py
index e73d14d7e9..da3159f153 100644
--- a/nova/tests/unit/test_notifications.py
+++ b/nova/tests/unit/test_notifications.py
@@ -198,21 +198,7 @@ class NotificationsTestCase(test.TestCase):
self.assertEqual(0, len(fake_notifier.NOTIFICATIONS))
self.assertEqual(0, len(fake_notifier.VERSIONED_NOTIFICATIONS))
- def get_fake_bandwidth(self):
- usage = objects.BandwidthUsage(context=self.context)
- usage.create(
- self.instance.uuid,
- mac='DE:AD:BE:EF:00:01',
- bw_in=1,
- bw_out=2,
- last_ctr_in=0,
- last_ctr_out=0,
- start_period='2012-10-29T13:42:11Z')
- return usage
-
- @mock.patch.object(objects.BandwidthUsageList, 'get_by_uuids')
- def test_vm_update_with_states(self, mock_bandwidth_list):
- mock_bandwidth_list.return_value = [self.get_fake_bandwidth()]
+ def test_vm_update_with_states(self):
fake_net_info = fake_network.fake_get_instance_nw_info(self)
self.instance.info_cache.network_info = fake_net_info
@@ -279,17 +265,11 @@ class NotificationsTestCase(test.TestCase):
self.assertEqual(actual_ip['address'], expected_ip['address'])
bandwidth = payload['bandwidth']
- self.assertEqual(len(bandwidth), 1)
- bandwidth = bandwidth[0]['nova_object.data']
- self.assertEqual(bandwidth['in_bytes'], 1)
- self.assertEqual(bandwidth['out_bytes'], 2)
- self.assertEqual(bandwidth['network_name'], 'test1')
-
- @mock.patch.object(objects.BandwidthUsageList, 'get_by_uuids')
- def test_task_update_with_states(self, mock_bandwidth_list):
+ self.assertEqual(0, len(bandwidth))
+
+ def test_task_update_with_states(self):
self.flags(notify_on_state_change="vm_and_task_state",
group='notifications')
- mock_bandwidth_list.return_value = [self.get_fake_bandwidth()]
fake_net_info = fake_network.fake_get_instance_nw_info(self)
self.instance.info_cache.network_info = fake_net_info