Add a --uuids-only option to rally task list
This option prints the list of UUIDs only. The motivation for this option is scripting, for example: for x in $(rally task list --status passed --uuids-only); \ do \ rally task report --tasks $x --out $x.html; \ done Change-Id: Ia967071bc3e4454116adbc59a790ab684efff15c Signed-off-by: Andrew McDermott <andrew.mcdermott@linaro.org>
This commit is contained in:
parent
9a1055a99b
commit
6b027669db
@ -29,7 +29,7 @@ _rally()
|
|||||||
OPTS["task_abort"]="--uuid"
|
OPTS["task_abort"]="--uuid"
|
||||||
OPTS["task_delete"]="--force --uuid"
|
OPTS["task_delete"]="--force --uuid"
|
||||||
OPTS["task_detailed"]="--uuid --iterations-data"
|
OPTS["task_detailed"]="--uuid --iterations-data"
|
||||||
OPTS["task_list"]="--deployment --all-deployments --status"
|
OPTS["task_list"]="--deployment --all-deployments --status --uuids-only"
|
||||||
OPTS["task_report"]="--tasks --out --open"
|
OPTS["task_report"]="--tasks --out --open"
|
||||||
OPTS["task_results"]="--uuid"
|
OPTS["task_results"]="--uuid"
|
||||||
OPTS["task_sla_check"]="--uuid --json"
|
OPTS["task_sla_check"]="--uuid --json"
|
||||||
|
@ -231,6 +231,36 @@ class TaskTestCase(unittest.TestCase):
|
|||||||
self.assertRaises(utils.RallyCmdError,
|
self.assertRaises(utils.RallyCmdError,
|
||||||
rally, "task list --status not_existing_status")
|
rally, "task list --status not_existing_status")
|
||||||
|
|
||||||
|
def test_list_with_print_uuids_option(self):
|
||||||
|
rally = utils.Rally()
|
||||||
|
cfg = self._get_sample_task_config()
|
||||||
|
config = utils.TaskConfig(cfg)
|
||||||
|
|
||||||
|
# Validate against zero tasks
|
||||||
|
self.assertEqual("", rally("task list --uuids-only"))
|
||||||
|
|
||||||
|
# Validate against a single task
|
||||||
|
res = rally("task start --task %s" % config.filename)
|
||||||
|
task_uuids = list()
|
||||||
|
for line in res.splitlines():
|
||||||
|
if "finished" in line:
|
||||||
|
task_uuids.append(line.split(" ")[1][:-1])
|
||||||
|
self.assertTrue(len(task_uuids))
|
||||||
|
self.assertIn(task_uuids[0],
|
||||||
|
rally("task list --uuids-only --deployment MAIN"))
|
||||||
|
|
||||||
|
# Validate against multiple tasks
|
||||||
|
for i in range(2):
|
||||||
|
rally("task start --task %s" % config.filename)
|
||||||
|
self.assertIn("finished", rally("task list --deployment MAIN"))
|
||||||
|
res = rally("task list --uuids-only --deployment MAIN")
|
||||||
|
task_uuids = res.split()
|
||||||
|
self.assertEqual(3, len(task_uuids))
|
||||||
|
res = rally("task list --uuids-only --deployment MAIN "
|
||||||
|
"--status finished")
|
||||||
|
for uuid in task_uuids:
|
||||||
|
self.assertIn(uuid, res)
|
||||||
|
|
||||||
def test_validate_is_valid(self):
|
def test_validate_is_valid(self):
|
||||||
rally = utils.Rally()
|
rally = utils.Rally()
|
||||||
cfg = self._get_sample_task_config()
|
cfg = self._get_sample_task_config()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user