diff --git a/ceilometer/hardware/pollsters/util.py b/ceilometer/hardware/pollsters/util.py index c18da9507..0e2f2e68a 100644 --- a/ceilometer/hardware/pollsters/util.py +++ b/ceilometer/hardware/pollsters/util.py @@ -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, diff --git a/ceilometer/tests/hardware/pollsters/base.py b/ceilometer/tests/hardware/pollsters/base.py index 446a22df4..363bc733b 100644 --- a/ceilometer/tests/hardware/pollsters/base.py +++ b/ceilometer/tests/hardware/pollsters/base.py @@ -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) diff --git a/ceilometer/tests/hardware/pollsters/test_cpu.py b/ceilometer/tests/hardware/pollsters/test_cpu.py index e64ae1f96..0f13638d0 100644 --- a/ceilometer/tests/hardware/pollsters/test_cpu.py +++ b/ceilometer/tests/hardware/pollsters/test_cpu.py @@ -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) diff --git a/ceilometer/tests/hardware/pollsters/test_disk.py b/ceilometer/tests/hardware/pollsters/test_disk.py index b9f931f21..7ac747678 100644 --- a/ceilometer/tests/hardware/pollsters/test_disk.py +++ b/ceilometer/tests/hardware/pollsters/test_disk.py @@ -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) diff --git a/ceilometer/tests/hardware/pollsters/test_memory.py b/ceilometer/tests/hardware/pollsters/test_memory.py index 66d60351d..56840e749 100644 --- a/ceilometer/tests/hardware/pollsters/test_memory.py +++ b/ceilometer/tests/hardware/pollsters/test_memory.py @@ -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) diff --git a/ceilometer/tests/hardware/pollsters/test_net.py b/ceilometer/tests/hardware/pollsters/test_net.py index 80e5faa18..1928fc68a 100644 --- a/ceilometer/tests/hardware/pollsters/test_net.py +++ b/ceilometer/tests/hardware/pollsters/test_net.py @@ -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)