summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-07-01 08:01:52 +0000
committerGerrit Code Review <review@openstack.org>2013-07-01 08:01:52 +0000
commitd376043bef1477a9aaab5037e8a38429cf5a6926 (patch)
tree32f9c92714bce966817ccba6706ccbb812d66f9d /nova/tests
parent52c8539e2dc6d055d4e5bdedffa5d05fec258eb7 (diff)
parent0946017e289cc865913980dbe199106d9b152cf3 (diff)
downloadnova-d376043bef1477a9aaab5037e8a38429cf5a6926.tar.gz
nova-d376043bef1477a9aaab5037e8a38429cf5a6926.tar.xz
nova-d376043bef1477a9aaab5037e8a38429cf5a6926.zip
Merge "Implement get_host_uptime for powervm driver"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/virt/powervm/test_powervm.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/nova/tests/virt/powervm/test_powervm.py b/nova/tests/virt/powervm/test_powervm.py
index 6628c23ea..fddd97a9d 100644
--- a/nova/tests/virt/powervm/test_powervm.py
+++ b/nova/tests/virt/powervm/test_powervm.py
@@ -173,7 +173,8 @@ class FakeBlockAdapter(powervm_blockdev.PowerVMLocalVolumeAdapter):
def fake_get_powervm_operator():
- return FakeIVMOperator(None)
+ return FakeIVMOperator(common.Connection('fake_host', 'fake_user',
+ 'fake_password'))
def create_instance(testcase):
@@ -618,6 +619,25 @@ class PowerVMDriverTestCase(test.TestCase):
self.assertEquals(host_stats['supported_instances'][0][1], "powervm")
self.assertEquals(host_stats['supported_instances'][0][2], "hvm")
+ def test_get_host_uptime(self):
+ """
+ Tests that the get_host_uptime method issues the proper sysstat command
+ and parses the output correctly.
+ """
+ exp_cmd = "ioscli sysstat -short fake_user"
+ output = [("02:54PM up 24 days, 5:41, 1 user, "
+ "load average: 0.06, 0.03, 0.02")]
+
+ fake_op = self.powervm_connection._powervm
+ self.mox.StubOutWithMock(fake_op._operator, 'run_vios_command')
+ fake_op._operator.run_vios_command(exp_cmd).AndReturn(output)
+
+ self.mox.ReplayAll()
+
+ # the host parameter isn't used so we just pass None
+ uptime = self.powervm_connection.get_host_uptime(None)
+ self.assertEquals("02:54PM up 24 days 5:41", uptime)
+
class PowerVMDriverLparTestCase(test.TestCase):
"""Unit tests for PowerVM connection calls."""