Corrected the sample names in hardware pollsters

Closes-Bug: #1291146

Change-Id: Ied60325e073d315f1108c54cd7771c1656816e59
This commit is contained in:
Lianhao Lu 2014-03-12 11:01:23 +08:00
parent c76bbb054b
commit ecbcaa3f6c
6 changed files with 21 additions and 16 deletions

View File

@ -39,7 +39,7 @@ def make_sample_from_host(host_url, name, type, unit, volume,
resource_metadata.update(get_metadata_from_host(host_url))
return sample.Sample(
name=name,
name='hardware.' + name,
type=type,
unit=unit,
volume=volume,

View File

@ -74,8 +74,8 @@ class TestPollsterBase(test_base.BaseTestCase):
self.assertIn(pollster.CACHE_KEY, cache)
self.assertIn(self.host[0], cache[pollster.CACHE_KEY])
self.assertEqual(set([s.name for s in samples]),
set([name]))
self.assertEqual(set([name]),
set([s.name for s in samples]))
match = [s for s in samples if s.name == name]
self.assertEqual(match[0].volume, expected_value)
self.assertEqual(match[0].type, expected_type)
self.assertEqual(expected_value, match[0].volume)
self.assertEqual(expected_type, match[0].type)

View File

@ -23,13 +23,16 @@ from ceilometer.tests.hardware.pollsters import base
class TestCPUPollsters(base.TestPollsterBase):
def test_1min(self):
self._check_get_samples(cpu.CPUUtil1MinPollster, 'cpu.util.1min',
self._check_get_samples(cpu.CPUUtil1MinPollster,
'hardware.cpu.util.1min',
0.99, sample.TYPE_GAUGE)
def test_5min(self):
self._check_get_samples(cpu.CPUUtil5MinPollster, 'cpu.util.5min',
self._check_get_samples(cpu.CPUUtil5MinPollster,
'hardware.cpu.util.5min',
0.77, sample.TYPE_GAUGE)
def test_15min(self):
self._check_get_samples(cpu.CPUUtil15MinPollster, 'cpu.util.15min',
self._check_get_samples(cpu.CPUUtil15MinPollster,
'hardware.cpu.util.15min',
0.55, sample.TYPE_GAUGE)

View File

@ -23,9 +23,11 @@ from ceilometer.tests.hardware.pollsters import base
class TestDiskPollsters(base.TestPollsterBase):
def test_disk_size_total(self):
self._check_get_samples(disk.DiskTotalPollster, 'disk.size.total',
self._check_get_samples(disk.DiskTotalPollster,
'hardware.disk.size.total',
1000, sample.TYPE_GAUGE)
def test_disk_size_used(self):
self._check_get_samples(disk.DiskUsedPollster, 'disk.size.used',
self._check_get_samples(disk.DiskUsedPollster,
'hardware.disk.size.used',
90, sample.TYPE_GAUGE)

View File

@ -24,10 +24,10 @@ from ceilometer.tests.hardware.pollsters import base
class TestMemoryPollsters(base.TestPollsterBase):
def test_memory_size_total(self):
self._check_get_samples(memory.MemoryTotalPollster,
'memory.total',
'hardware.memory.total',
1000, sample.TYPE_GAUGE)
def test_memory_size_used(self):
self._check_get_samples(memory.MemoryUsedPollster,
'memory.used',
'hardware.memory.used',
90, sample.TYPE_GAUGE)

View File

@ -24,20 +24,20 @@ from ceilometer.tests.hardware.pollsters import base
class TestNetPollsters(base.TestPollsterBase):
def test_bandwidth(self):
self._check_get_samples(net.BandwidthBytesPollster,
'network.bandwidth.bytes',
'hardware.network.bandwidth.bytes',
1000, sample.TYPE_CUMULATIVE)
def test_incoming(self):
self._check_get_samples(net.IncomingBytesPollster,
'network.incoming.bytes',
'hardware.network.incoming.bytes',
90, sample.TYPE_CUMULATIVE)
def test_outgoing(self):
self._check_get_samples(net.OutgoingBytesPollster,
'network.outgoing.bytes',
'hardware.network.outgoing.bytes',
80, sample.TYPE_CUMULATIVE)
def test_error(self):
self._check_get_samples(net.OutgoingErrorsPollster,
'network.outgoing.errors',
'hardware.network.outgoing.errors',
1, sample.TYPE_CUMULATIVE)