summaryrefslogtreecommitdiff
path: root/nova/tests/test_notifications.py
diff options
context:
space:
mode:
authorJohn Garbutt <john.garbutt@rackspace.com>2014-09-08 12:23:15 +0100
committerJohn Garbutt <john@johngarbutt.com>2014-09-17 12:53:40 +0000
commit974c3b8cffbc708e7f816add7e79dbf72efccdd1 (patch)
tree60604494a09104dd77949de2612a6be0ae3fa765 /nova/tests/test_notifications.py
parent6072f516265ea2c05cb2815820672c55d38e34a9 (diff)
downloadnova-974c3b8cffbc708e7f816add7e79dbf72efccdd1.tar.gz
Add progress and cell_name into notifications
When the instance DB record is updated, we send notifications. To make those more useful, I have added in cell_name and progress. These fields where added after the initial notifications were added. Change-Id: I3bc770e3b8f211c27e5e4aadd1819507d643cc75 Closes-Bug: #1366758
Diffstat (limited to 'nova/tests/test_notifications.py')
-rw-r--r--nova/tests/test_notifications.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/nova/tests/test_notifications.py b/nova/tests/test_notifications.py
index e15824657a..ad52ee48e6 100644
--- a/nova/tests/test_notifications.py
+++ b/nova/tests/test_notifications.py
@@ -285,6 +285,34 @@ class NotificationsTestCase(test.TestCase):
self.assertEqual(self.net_info[0]['address'],
info["fixed_ips"][0]["vif_mac"])
+ def test_payload_has_cell_name_empty(self):
+ info = notifications.info_from_instance(self.context, self.instance,
+ self.net_info, None)
+ self.assertIn("cell_name", info)
+ self.assertIsNone(self.instance['cell_name'])
+ self.assertEqual("", info["cell_name"])
+
+ def test_payload_has_cell_name(self):
+ self.instance['cell_name'] = "cell1"
+ info = notifications.info_from_instance(self.context, self.instance,
+ self.net_info, None)
+ self.assertIn("cell_name", info)
+ self.assertEqual("cell1", info["cell_name"])
+
+ def test_payload_has_progress_empty(self):
+ info = notifications.info_from_instance(self.context, self.instance,
+ self.net_info, None)
+ self.assertIn("progress", info)
+ self.assertIsNone(self.instance['progress'])
+ self.assertEqual("", info["progress"])
+
+ def test_payload_has_progress(self):
+ self.instance['progress'] = 50
+ info = notifications.info_from_instance(self.context, self.instance,
+ self.net_info, None)
+ self.assertIn("progress", info)
+ self.assertEqual(50, info["progress"])
+
def test_send_access_ip_update(self):
notifications.send_update(self.context, self.instance, self.instance)
self.assertEqual(1, len(fake_notifier.NOTIFICATIONS))