From 0d41200ee635a770e3333d908592e03d7d43b520 Mon Sep 17 00:00:00 2001 From: Rohan Kanade Date: Fri, 6 Jun 2014 13:56:38 +0200 Subject: [PATCH] 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 --- rally/orchestrator/api.py | 6 +++--- tests/orchestrator/test_api.py | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/rally/orchestrator/api.py b/rally/orchestrator/api.py index 3ffe26f5da..6754c1e8b6 100644 --- a/rally/orchestrator/api.py +++ b/rally/orchestrator/api.py @@ -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() diff --git a/tests/orchestrator/test_api.py b/tests/orchestrator/test_api.py index f24ab0bb12..b5cdf1ab11 100644 --- a/tests/orchestrator/test_api.py +++ b/tests/orchestrator/test_api.py @@ -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)