Merge "Add aliases "rally task|deployment|verify use""
This commit is contained in:
commit
adb725f861
@ -255,3 +255,12 @@ class DeploymentCommands(object):
|
||||
% sys.exc_info()[1])
|
||||
return(1)
|
||||
common_cliutils.print_list(table_rows, headers)
|
||||
|
||||
@cliutils.args("--deployment", type=str, dest="deployment",
|
||||
help="UUID or name of the deployment")
|
||||
def use(self, deployment):
|
||||
"""Set active deployment. Alias for "rally use deployment".
|
||||
|
||||
:param deployment: UUID or name of a deployment
|
||||
"""
|
||||
use.UseCommands().deployment(deployment)
|
@ -621,3 +621,12 @@ class TaskCommands(object):
|
||||
common_cliutils.print_list(data, ("benchmark", "pos", "criterion",
|
||||
"status", "detail"))
|
||||
return failed_criteria
|
||||
|
||||
@cliutils.args("--task", type=str, dest="task", required=False,
|
||||
help="UUID of the task")
|
||||
def use(self, task):
|
||||
"""Set active task. Alias for "rally use task".
|
||||
|
||||
:param task: Task uuid.
|
||||
"""
|
||||
use.UseCommands().task(task)
|
||||
|
@ -266,3 +266,12 @@ class VerifyCommands(object):
|
||||
f.write(result)
|
||||
else:
|
||||
print(result)
|
||||
|
||||
@cliutils.args("--verification", type=str, dest="verification",
|
||||
required=False, help="UUID of the verification")
|
||||
def use(self, verification):
|
||||
"""Set active verification. Alias for "rally use verification"
|
||||
|
||||
:param verification: a UUID of verification
|
||||
"""
|
||||
use.UseCommands().verification(verification)
|
@ -71,26 +71,36 @@ function do_verification {
|
||||
gzip -9 ${RESULTS_DIR}/${1}_verify_show_detailed.txt
|
||||
}
|
||||
|
||||
do_verification 1
|
||||
do_verification 2
|
||||
function main {
|
||||
do_verification 1
|
||||
do_verification 2
|
||||
|
||||
rally verify list > ${RESULTS_DIR}/verify_list.txt
|
||||
RESULTS+="l=$(do_status $?) "
|
||||
gzip -9 ${RESULTS_DIR}/verify_list.txt
|
||||
rally verify list > ${RESULTS_DIR}/verify_list.txt
|
||||
RESULTS+="l=$(do_status $?) "
|
||||
gzip -9 ${RESULTS_DIR}/verify_list.txt
|
||||
|
||||
# Compare and save results in different formats
|
||||
for OUTPUT_FORMAT in "csv" "html" "json"
|
||||
do
|
||||
OUTPUT_FILE=${RESULTS_DIR}/compare_results.${OUTPUT_FORMAT}
|
||||
rally --rally-debug verify compare --uuid-1 ${VERIFICATIONS[1]} --uuid-2 ${VERIFICATIONS[2]} --${OUTPUT_FORMAT} --output-file ${OUTPUT_FILE}
|
||||
RESULTS+="c_${OUTPUT_FORMAT}=$(do_status $?) "
|
||||
gzip -9 ${OUTPUT_FILE}
|
||||
done
|
||||
# Compare and save results in different formats
|
||||
for OUTPUT_FORMAT in "csv" "html" "json"
|
||||
do
|
||||
OUTPUT_FILE=${RESULTS_DIR}/compare_results.${OUTPUT_FORMAT}
|
||||
rally --rally-debug verify compare --uuid-1 ${VERIFICATIONS[1]} --uuid-2 ${VERIFICATIONS[2]} --${OUTPUT_FORMAT} --output-file ${OUTPUT_FILE}
|
||||
RESULTS+="c_${OUTPUT_FORMAT}=$(do_status $?) "
|
||||
gzip -9 ${OUTPUT_FILE}
|
||||
done
|
||||
|
||||
python $BASE/new/rally/rally/ui/utils.py render\
|
||||
tests/ci/rally-gate/index_verify.mako ${RESULTS[*]}> ${RESULTS_DIR}/extra/index.html
|
||||
python $BASE/new/rally/rally/ui/utils.py render\
|
||||
tests/ci/rally-gate/index_verify.mako ${RESULTS[*]}> ${RESULTS_DIR}/extra/index.html
|
||||
|
||||
if [[ ${RESULTS[*]} == *"fail"* ]]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
if [[ ${RESULTS[*]} == *"fail"* ]]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
RESULT_USE=$(rally verify use --verification ${VERIFICATIONS[1]})
|
||||
if [ "$RESULT_USE" != "Verification UUID: ${VERIFICATIONS[1]}" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
@ -14,10 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
import re
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
|
||||
from rally.cmd import envutils
|
||||
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 recreate --deployment t_create_env")
|
||||
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)
|
@ -473,6 +473,22 @@ class TaskTestCase(unittest.TestCase):
|
||||
def test_abort(self):
|
||||
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):
|
||||
|
||||
|
@ -202,3 +202,8 @@ class DeploymentCommandsTestCase(test.TestCase):
|
||||
mock_default.side_effect = exceptions.InvalidArgumentsException
|
||||
self.assertRaises(exceptions.InvalidArgumentsException,
|
||||
self.deployment.show, None)
|
||||
|
||||
@mock.patch("rally.cmd.commands.use.UseCommands.deployment")
|
||||
def test_use(self, mock_use_deployment):
|
||||
self.deployment.use("fake_id")
|
||||
mock_use_deployment.assert_called_once_with("fake_id")
|
@ -595,3 +595,8 @@ class TaskCommandsTestCase(test.TestCase):
|
||||
self.assertEqual(1, result)
|
||||
mock_task_validate.assert_called_once_with("deployment",
|
||||
mock_load.return_value)
|
||||
|
||||
@mock.patch("rally.cmd.commands.use.UseCommands.task")
|
||||
def test_use(self, mock_use_task):
|
||||
self.task.use("fake_id")
|
||||
mock_use_task.assert_called_once_with("fake_id")
|
||||
|
@ -300,3 +300,8 @@ class VerifyCommandsTestCase(test.TestCase):
|
||||
|
||||
mock_open.assert_called_once_with("results", "wb")
|
||||
mock_open.side_effect().write.assert_called_once_with("")
|
||||
|
||||
@mock.patch("rally.cmd.commands.use.UseCommands.verification")
|
||||
def test_use(self, mock_use_verification):
|
||||
self.verify.use("fake_id")
|
||||
mock_use_verification.assert_called_once_with("fake_id")
|
@ -13,6 +13,7 @@ _rally()
|
||||
OPTS["deployment_list"]=""
|
||||
OPTS["deployment_recreate"]="--deployment"
|
||||
OPTS["deployment_show"]="--deployment"
|
||||
OPTS["deployment_use"]="--deployment"
|
||||
OPTS["info_BenchmarkScenarios"]=""
|
||||
OPTS["info_DeployEngines"]=""
|
||||
OPTS["info_DeploymentEngines"]=""
|
||||
@ -34,6 +35,7 @@ _rally()
|
||||
OPTS["task_sla_check"]="--uuid --json"
|
||||
OPTS["task_start"]="--deployment --task --task-args --task-args-file --tag --no-use --abort-on-sla-failure"
|
||||
OPTS["task_status"]="--uuid"
|
||||
OPTS["task_use"]="--task"
|
||||
OPTS["task_validate"]="--deployment --task --task-args --task-args-file"
|
||||
OPTS["use_deployment"]="--deployment"
|
||||
OPTS["use_task"]="--uuid"
|
||||
@ -44,6 +46,7 @@ _rally()
|
||||
OPTS["verify_results"]="--uuid --html --json --output-file"
|
||||
OPTS["verify_show"]="--uuid --sort-by --detailed"
|
||||
OPTS["verify_start"]="--deployment --set --regex --tempest-config --no-use"
|
||||
OPTS["verify_use"]="--verification"
|
||||
|
||||
|
||||
for OPT in ${!OPTS[*]} ; do
|
||||
|
Loading…
Reference in New Issue
Block a user