Auto install tempest during "rally verify"

If tempest is not installed before running "rally verify"
Install tempest for the user instead of exiting

Change-Id: I3cdf514c55f9942e74bb061dda5a5fd2f7ab16ac
This commit is contained in:
Rohan Kanade 2014-06-06 13:56:38 +02:00
parent dc256f70ab
commit 0d41200ee6
2 changed files with 16 additions and 3 deletions

View File

@ -143,9 +143,9 @@ def verify(deploy_id, set_name, regex):
verification = objects.Verification(deployment_uuid=deploy_id)
verifier = tempest.Tempest(deploy_id, verification=verification)
if not verifier.is_installed():
print("Tempest is not installed for specified deployment. "
"Please use 'rally-manage tempest install'")
return
print("Tempest is not installed for specified deployment.")
print("Installing Tempest for deployment %s" % deploy_id)
verifier.install()
LOG.info("Starting verification of deployment: %s" % deploy_id)
verification.set_running()

View File

@ -225,3 +225,16 @@ class APITestCase(test.TestCase):
self.tempest.is_installed.assert_called_once_with()
self.tempest.verify.assert_called_once_with(set_name='smoke',
regex=None)
@mock.patch('rally.orchestrator.api.objects.Verification')
@mock.patch('rally.verification.verifiers.tempest.tempest.Tempest')
def test_verify_tempest_not_installed(self, mock_tempest,
mock_verification):
mock_tempest.return_value = self.tempest
self.tempest.is_installed.return_value = False
api.verify(self.deploy_uuid, 'smoke', None)
self.tempest.is_installed.assert_called_once_with()
self.tempest.install.assert_called_once_with()
self.tempest.verify.assert_called_once_with(set_name='smoke',
regex=None)