Merge "Add task command rally task import"

This commit is contained in:
Jenkins 2017-05-31 15:51:35 +00:00 committed by Gerrit Code Review
commit 1b384fe940
3 changed files with 16 additions and 0 deletions

View File

@ -32,6 +32,7 @@ _rally()
OPTS["task_delete"]="--force --uuid"
OPTS["task_detailed"]="--uuid --iterations-data"
OPTS["task_export"]="--uuid --connection"
OPTS["task_import"]="--file --deployment --tag"
OPTS["task_list"]="--deployment --all-deployments --status --uuids-only"
OPTS["task_report"]="--tasks --out --open --html --html-static --junit"
OPTS["task_results"]="--uuid"

View File

@ -123,6 +123,7 @@ function run () {
cp $TASK rally-plot/task.txt
tar -czf rally-plot/plugins.tar.gz -C $RALLY_PLUGINS_DIR .
rally task results | python -m json.tool > rally-plot/results.json
rally task import --file rally-plot/results.json
gzip -9 rally-plot/results.json
rally task detailed > rally-plot/detailed.txt
gzip -9 rally-plot/detailed.txt

View File

@ -171,6 +171,20 @@ class TaskTestCase(unittest.TestCase):
self.assertRaises(utils.RallyCliError,
rally, "task results --uuid %s" % FAKE_TASK_UUID)
def test_import_results(self):
rally = utils.Rally()
cfg = self._get_sample_task_config()
config = utils.TaskConfig(cfg)
rally("task start --task %s" % config.filename)
json_report = rally.gen_report_path(extension="json")
with open(json_report, "w+") as f:
f.write(rally("task results"))
import_print = rally("task import --file %s" % json_report)
self.assertIn("successfully", import_print)
task_uuid = re.search("UUID:\s([a-z0-9\-]+)", import_print).group(1)
self.assertIn("Dummy.dummy_random_fail_in_atomic",
rally("task results --uuid %s" % task_uuid))
def test_abort_with_wrong_task_id(self):
rally = utils.Rally()
self.assertRaises(utils.RallyCliError,