From f03fcccc69f5da3a9cc7b39f640a93370f19d1c1 Mon Sep 17 00:00:00 2001 From: Alexander Maretskiy Date: Thu, 17 Mar 2016 18:09:13 +0200 Subject: [PATCH] [Reports][CLI] Introduce Trends report New HTML report for statistics trends for given tasks which is generated by cli command "rally task trends". Blueprint: trends-report Change-Id: I0805058e8bd225796b02516fad094d73037d5495 --- etc/rally.bash_completion | 3 ++- tests/functional/test_cli_task.py | 34 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/etc/rally.bash_completion b/etc/rally.bash_completion index b84eefb0..9d588e0f 100644 --- a/etc/rally.bash_completion +++ b/etc/rally.bash_completion @@ -43,6 +43,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_trends"]="--out --open --tasks" OPTS["task_use"]="--uuid" OPTS["task_validate"]="--deployment --task --task-args --task-args-file" OPTS["verify_compare"]="--uuid-1 --uuid-2 --csv --html --json --output-file --threshold" @@ -87,4 +88,4 @@ _rally() return 0 } -complete -o filenames -F _rally rally \ No newline at end of file +complete -o filenames -F _rally rally diff --git a/tests/functional/test_cli_task.py b/tests/functional/test_cli_task.py index f171f172..bdd6cea8 100644 --- a/tests/functional/test_cli_task.py +++ b/tests/functional/test_cli_task.py @@ -317,6 +317,40 @@ class TaskTestCase(unittest.TestCase): self.assertTrue(os.path.exists(html_report)) self._assert_html_report_libs_are_embedded(html_report) + def test_trends(self): + cfg1 = { + "Dummy.dummy": [ + {"runner": {"type": "constant", "times": 2, + "concurrency": 2}}], + "Dummy.dummy_random_action": [ + {"args": {"actions_num": 4}, + "runner": {"type": "constant", "times": 2, "concurrency": 2}}, + {"runner": {"type": "constant", "times": 2, + "concurrency": 2}}]} + cfg2 = { + "Dummy.dummy": [ + {"args": {"sleep": 0.6}, + "runner": {"type": "constant", "times": 2, + "concurrency": 2}}]} + + config1 = utils.TaskConfig(cfg1) + config2 = utils.TaskConfig(cfg2) + rally = utils.Rally() + report = rally.gen_report_path(extension="html") + + for i in range(5): + rally("task start --task %(file)s --tag trends_run_%(idx)d" + % {"file": config1.filename, "idx": i}) + rally("task start --task %s --tag trends_run_once" % config2.filename) + + tasks_list = rally("task list") + uuids = [u[2:38] for u in tasks_list.split("\n") if "trends_run" in u] + + rally("task trends %(uuids)s --out %(report)s" + % {"uuids": " ".join(uuids), "report": report}) + del config1, config2 + self.assertTrue(os.path.exists(report)) + def test_delete(self): rally = utils.Rally() cfg = self._get_sample_task_config()