Add meaningful server diagnostic information to fake hypervisor
Previously the fake hypervisor didn't returned a fake information similar to the real output so this patch add this sample fake information. Also removed a duplicated check on the tests Change-Id: Iab72a867e6e2606beb15db17701375f3c8f61a79
This commit is contained in:
parent
8cb329b2a0
commit
ad2d4c379c
@ -1217,16 +1217,29 @@ class ComputeTestCase(BaseTestCase):
|
||||
|
||||
def test_diagnostics(self):
|
||||
"""Make sure we can get diagnostics for an instance."""
|
||||
expected_diagnostic = {'cpu0_time': 17300000000,
|
||||
'memory': 524288,
|
||||
'vda_errors': -1,
|
||||
'vda_read': 262144,
|
||||
'vda_read_req': 112,
|
||||
'vda_write': 5778432,
|
||||
'vda_write_req': 488,
|
||||
'vnet1_rx': 2070139,
|
||||
'vnet1_rx_drop': 0,
|
||||
'vnet1_rx_errors': 0,
|
||||
'vnet1_rx_packets': 26701,
|
||||
'vnet1_tx': 140208,
|
||||
'vnet1_tx_drop': 0,
|
||||
'vnet1_tx_errors': 0,
|
||||
'vnet1_tx_packets': 662,
|
||||
}
|
||||
|
||||
instance = jsonutils.to_primitive(self._create_fake_instance())
|
||||
self.compute.run_instance(self.context, instance=instance)
|
||||
|
||||
diagnostics = self.compute.get_diagnostics(self.context,
|
||||
instance=instance)
|
||||
self.assertEqual(diagnostics, 'FAKE_DIAGNOSTICS')
|
||||
|
||||
diagnostics = self.compute.get_diagnostics(self.context,
|
||||
instance=instance)
|
||||
self.assertEqual(diagnostics, 'FAKE_DIAGNOSTICS')
|
||||
self.assertEqual(diagnostics, expected_diagnostic)
|
||||
self.compute.terminate_instance(self.context, instance=instance)
|
||||
|
||||
def test_add_fixed_ip_usage_notification(self):
|
||||
|
@ -184,7 +184,22 @@ class FakeDriver(driver.ComputeDriver):
|
||||
'cpu_time': 0}
|
||||
|
||||
def get_diagnostics(self, instance_name):
|
||||
return 'FAKE_DIAGNOSTICS'
|
||||
return {'cpu0_time': 17300000000,
|
||||
'memory': 524288,
|
||||
'vda_errors': -1,
|
||||
'vda_read': 262144,
|
||||
'vda_read_req': 112,
|
||||
'vda_write': 5778432,
|
||||
'vda_write_req': 488,
|
||||
'vnet1_rx': 2070139,
|
||||
'vnet1_rx_drop': 0,
|
||||
'vnet1_rx_errors': 0,
|
||||
'vnet1_rx_packets': 26701,
|
||||
'vnet1_tx': 140208,
|
||||
'vnet1_tx_drop': 0,
|
||||
'vnet1_tx_errors': 0,
|
||||
'vnet1_tx_packets': 662,
|
||||
}
|
||||
|
||||
def get_all_bw_counters(self, instances):
|
||||
"""Return bandwidth usage counters for each interface on each
|
||||
|
Loading…
x
Reference in New Issue
Block a user