diff --git a/etc/rally.bash_completion b/etc/rally.bash_completion index da510677..76a0e502 100644 --- a/etc/rally.bash_completion +++ b/etc/rally.bash_completion @@ -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" diff --git a/tests/ci/rally_gate_functions.sh b/tests/ci/rally_gate_functions.sh index 98b749db..69e28a5e 100644 --- a/tests/ci/rally_gate_functions.sh +++ b/tests/ci/rally_gate_functions.sh @@ -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 diff --git a/tests/functional/test_cli_task.py b/tests/functional/test_cli_task.py index 9db44d54..5d261637 100644 --- a/tests/functional/test_cli_task.py +++ b/tests/functional/test_cli_task.py @@ -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,