import new json report into rally db
We have supported to export a new json report, now it is required to import new json report into rally database. Change-Id: Ia979354115df819ea8f6de3f301bc46ca6e13fd9
This commit is contained in:
parent
52c4a0b27b
commit
5a41c3845f
@ -135,6 +135,7 @@ function run () {
|
||||
rally task report --html-static --out rally-plot/results.html
|
||||
gzip -9 rally-plot/results.html
|
||||
rally task report --json --out rally-plot/new_results.json
|
||||
rally task import --file rally-plot/new_results.json
|
||||
gzip -9 rally-plot/new_results.json
|
||||
rally task export --type junit-xml --to rally-plot/junit.xml
|
||||
gzip -9 rally-plot/junit.xml
|
||||
|
@ -20,6 +20,7 @@ import threading
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import jsonschema
|
||||
import mock
|
||||
|
||||
from rally import api
|
||||
@ -186,6 +187,14 @@ class TaskTestCase(unittest.TestCase):
|
||||
self.assertIn("Dummy.dummy_random_fail_in_atomic",
|
||||
rally("task results --uuid %s" % task_uuid))
|
||||
|
||||
# new json report
|
||||
rally("task report --json --out %s" % json_report)
|
||||
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 report --uuid %s --json" % task_uuid))
|
||||
|
||||
def test_abort_with_wrong_task_id(self):
|
||||
rally = utils.Rally()
|
||||
self.assertRaises(utils.RallyCliError,
|
||||
@ -367,12 +376,9 @@ class TaskTestCase(unittest.TestCase):
|
||||
results = json.loads(open(file_path).read())
|
||||
self.assertIn("info", results)
|
||||
self.assertIn("tasks", results)
|
||||
# TODO(chenhb): We will switch to check this
|
||||
# json via json schema in next patch
|
||||
for task in results["tasks"]:
|
||||
self.assertIn("subtasks", task)
|
||||
for subtask in task["subtasks"]:
|
||||
self.assertIn("workloads", subtask)
|
||||
jsonschema.validate(task,
|
||||
api._Task.TASK_SCHEMA)
|
||||
|
||||
def test_report_one_uuid_with_json(self):
|
||||
rally = utils.Rally()
|
||||
|
Loading…
Reference in New Issue
Block a user