Add aliases "rally task|deployment|verify use"

Add alias "rally task use" for "rally use task",
"rally deployment use" for "rally use deployment"
and "rally verify use" for "rally use verification"

Change-Id: I6e63f4b60e1faf794f050f98be127744fe8011a4
This commit is contained in:
Olga Kopylova 2015-01-28 11:15:42 +02:00
parent 77a0644e73
commit 92ef11be17
2 changed files with 29 additions and 0 deletions

View File

@ -14,10 +14,12 @@
# under the License. # under the License.
import json import json
import re
import unittest import unittest
import mock import mock
from rally.cmd import envutils
from tests.functional import utils from tests.functional import utils
@ -77,3 +79,14 @@ class DeploymentTestCase(unittest.TestCase):
self.rally("deployment create --name t_create_env --fromenv") self.rally("deployment create --name t_create_env --fromenv")
self.rally("deployment recreate --deployment t_create_env") self.rally("deployment recreate --deployment t_create_env")
self.assertIn("t_create_env", self.rally("deployment list")) self.assertIn("t_create_env", self.rally("deployment list"))
def test_use(self):
with mock.patch.dict("os.environ", utils.TEST_ENV):
output = self.rally(
"deployment create --name t_create_env1 --fromenv")
uuid = re.search(r"Using deployment: (?P<uuid>[0-9a-f\-]{36})",
output).group("uuid")
self.rally("deployment create --name t_create_env2 --fromenv")
self.rally("deployment use --deployment %s" % uuid)
current_deployment = envutils.get_global("RALLY_DEPLOYMENT")
self.assertEqual(uuid, current_deployment)

View File

@ -247,6 +247,22 @@ class TaskTestCase(unittest.TestCase):
def test_abort(self): def test_abort(self):
pass pass
def test_use(self):
rally = utils.Rally()
with mock.patch.dict("os.environ", utils.TEST_ENV):
deployment_id = envutils.get_global("RALLY_DEPLOYMENT")
config = utils.TaskConfig(self._get_sample_task_config())
output = rally(("task start --task %(task_file)s "
"--deployment %(deployment_id)s") %
{"task_file": config.filename,
"deployment_id": deployment_id})
result = re.search(
r"(?P<uuid>[0-9a-f\-]{36}): started", output)
uuid = result.group("uuid")
rally("task use --task %s" % uuid)
current_task = envutils.get_global("RALLY_TASK")
self.assertEqual(uuid, current_task)
class SLATestCase(unittest.TestCase): class SLATestCase(unittest.TestCase):