Change counter to sample in network tests

This changes counter to sample vocable in network tests

Parts of the blueprint remove-counter

Change-Id: Ic57ee893440f6c973a3b9f1ca6c1334843168ae1
This commit is contained in:
Mehdi Abaakouk 2013-08-20 18:24:27 +02:00
parent efc491b94d
commit 149eded143
2 changed files with 20 additions and 20 deletions

View File

@ -81,7 +81,7 @@ class TestFloatingIPPollster(base.TestCase):
self.assertEqual(samples[2].resource_metadata["address"], "1.1.1.3") self.assertEqual(samples[2].resource_metadata["address"], "1.1.1.3")
self.assertEqual(samples[2].resource_metadata["pool"], "public") self.assertEqual(samples[2].resource_metadata["pool"], "public")
def test_get_counter_names(self): def test_get_meter_names(self):
samples = list(self.pollster.get_samples(self.manager, {})) samples = list(self.pollster.get_samples(self.manager, {}))
self.assertEqual(set([s.name for s in samples]), self.assertEqual(set([s.name for s in samples]),
set(['ip.floating'])) set(['ip.floating']))

View File

@ -206,43 +206,43 @@ NOTIFICATION_FLOATINGIP_EXISTS = {
class TestNotifications(base.TestCase): class TestNotifications(base.TestCase):
def test_network_create(self): def test_network_create(self):
v = notifications.Network() v = notifications.Network()
counters = list(v.process_notification(NOTIFICATION_NETWORK_CREATE)) samples = list(v.process_notification(NOTIFICATION_NETWORK_CREATE))
self.assertEqual(len(counters), 2) self.assertEqual(len(samples), 2)
self.assertEqual(counters[1].name, "network.create") self.assertEqual(samples[1].name, "network.create")
def test_subnet_create(self): def test_subnet_create(self):
v = notifications.Subnet() v = notifications.Subnet()
counters = list(v.process_notification(NOTIFICATION_SUBNET_CREATE)) samples = list(v.process_notification(NOTIFICATION_SUBNET_CREATE))
self.assertEqual(len(counters), 2) self.assertEqual(len(samples), 2)
self.assertEqual(counters[1].name, "subnet.create") self.assertEqual(samples[1].name, "subnet.create")
def test_port_create(self): def test_port_create(self):
v = notifications.Port() v = notifications.Port()
counters = list(v.process_notification(NOTIFICATION_PORT_CREATE)) samples = list(v.process_notification(NOTIFICATION_PORT_CREATE))
self.assertEqual(len(counters), 2) self.assertEqual(len(samples), 2)
self.assertEqual(counters[1].name, "port.create") self.assertEqual(samples[1].name, "port.create")
def test_port_update(self): def test_port_update(self):
v = notifications.Port() v = notifications.Port()
counters = list(v.process_notification(NOTIFICATION_PORT_UPDATE)) samples = list(v.process_notification(NOTIFICATION_PORT_UPDATE))
self.assertEqual(len(counters), 2) self.assertEqual(len(samples), 2)
self.assertEqual(counters[1].name, "port.update") self.assertEqual(samples[1].name, "port.update")
def test_network_exists(self): def test_network_exists(self):
v = notifications.Network() v = notifications.Network()
counters = v.process_notification(NOTIFICATION_NETWORK_EXISTS) samples = v.process_notification(NOTIFICATION_NETWORK_EXISTS)
self.assertEqual(len(list(counters)), 1) self.assertEqual(len(list(samples)), 1)
def test_router_exists(self): def test_router_exists(self):
v = notifications.Router() v = notifications.Router()
counters = v.process_notification(NOTIFICATION_ROUTER_EXISTS) samples = v.process_notification(NOTIFICATION_ROUTER_EXISTS)
self.assertEqual(len(list(counters)), 1) self.assertEqual(len(list(samples)), 1)
def test_floatingip_exists(self): def test_floatingip_exists(self):
v = notifications.FloatingIP() v = notifications.FloatingIP()
counters = list(v.process_notification(NOTIFICATION_FLOATINGIP_EXISTS)) samples = list(v.process_notification(NOTIFICATION_FLOATINGIP_EXISTS))
self.assertEqual(len(counters), 1) self.assertEqual(len(samples), 1)
self.assertEqual(counters[0].name, "ip.floating") self.assertEqual(samples[0].name, "ip.floating")
class TestEventTypes(base.TestCase): class TestEventTypes(base.TestCase):