Add task exporter to the file system
This is the first task exporter plugin. It used to export rally task results to the file in json format. Change-Id: I25117933ac0881453a001d96600d4c95e6064fff
This commit is contained in:
parent
d51eb6985f
commit
e37a78443b
@ -36,6 +36,7 @@ _rally()
|
||||
OPTS["task_abort"]="--uuid --soft"
|
||||
OPTS["task_delete"]="--force --uuid"
|
||||
OPTS["task_detailed"]="--uuid --iterations-data"
|
||||
OPTS["task_export"]="--uuid --connection"
|
||||
OPTS["task_list"]="--deployment --all-deployments --status --uuids-only"
|
||||
OPTS["task_report"]="--tasks --out --open --html --html-static --junit"
|
||||
OPTS["task_results"]="--uuid"
|
||||
@ -86,4 +87,4 @@ _rally()
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -o filenames -F _rally rally
|
||||
complete -o filenames -F _rally rally
|
||||
|
@ -740,6 +740,59 @@ class TaskTestCase(unittest.TestCase):
|
||||
r"(?P<task_id>[0-9a-f\-]{36}): started", output)
|
||||
self.assertIsNotNone(result)
|
||||
|
||||
def test_export(self):
|
||||
rally = utils.Rally()
|
||||
cfg = {
|
||||
"Dummy.dummy": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 100,
|
||||
"concurrency": 5
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
config = utils.TaskConfig(cfg)
|
||||
output = rally("task start --task %s" % config.filename)
|
||||
uuid = re.search(
|
||||
r"(?P<uuid>[0-9a-f\-]{36}): started", output).group("uuid")
|
||||
connection = (
|
||||
"file-exporter:///" + rally.gen_report_path(extension="json"))
|
||||
output = rally("task export --uuid %s --connection %s" % (
|
||||
uuid, connection))
|
||||
expected = (
|
||||
"Task %(uuid)s results was successfully exported to %("
|
||||
"connection)s using file-exporter plugin." % {
|
||||
"uuid": uuid,
|
||||
"connection": connection,
|
||||
})
|
||||
self.assertIn(expected, output)
|
||||
|
||||
def test_export_with_wrong_connection(self):
|
||||
rally = utils.Rally()
|
||||
cfg = {
|
||||
"Dummy.dummy": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 100,
|
||||
"concurrency": 5
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
config = utils.TaskConfig(cfg)
|
||||
output = rally("task start --task %s" % config.filename)
|
||||
uuid = re.search(
|
||||
r"(?P<uuid>[0-9a-f\-]{36}): started", output).group("uuid")
|
||||
connection = (
|
||||
"fake:///" + rally.gen_report_path(extension="json"))
|
||||
self.assertRaises(utils.RallyCliError,
|
||||
rally,
|
||||
"task export --uuid %s --connection %s" % (
|
||||
uuid, connection))
|
||||
|
||||
|
||||
class SLATestCase(unittest.TestCase):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user