Fix rally task detailed --iterations-data
In case an input scenario had no atomic actions, the "--iterations-data" table contained "n/a" values. Here we fix this and enhance the corresponding functional tests. Change-Id: Ic4d3809f64bcfcbce804023de7ce0c2d1f6e965f Closes-Bug: 1420703
This commit is contained in:
parent
3f5e5ee36f
commit
ce498c14a3
@ -273,16 +273,11 @@ class TaskCommands(object):
|
||||
for col in float_cols]))
|
||||
for (c, r) in enumerate(raw_data, 1):
|
||||
dlist = [c]
|
||||
dlist.append(r["duration"])
|
||||
if r["atomic_actions"]:
|
||||
dlist.append(r["duration"])
|
||||
for action in atomic_actions:
|
||||
dlist.append(r["atomic_actions"].get(action) or 0)
|
||||
table_rows.append(rutils.Struct(**dict(zip(headers,
|
||||
dlist))))
|
||||
else:
|
||||
data = dlist + [None for i in range(1, len(headers))]
|
||||
table_rows.append(rutils.Struct(**dict(zip(headers,
|
||||
data))))
|
||||
table_rows.append(rutils.Struct(**dict(zip(headers, dlist))))
|
||||
common_cliutils.print_list(table_rows,
|
||||
fields=headers,
|
||||
formatters=formatters)
|
||||
|
@ -63,6 +63,27 @@ class TaskTestCase(unittest.TestCase):
|
||||
self.assertIn("dummy_fail_test (2)", detailed)
|
||||
detailed_iterations_data = rally("task detailed --iterations-data")
|
||||
self.assertIn("2. dummy_fail_test (2)", detailed_iterations_data)
|
||||
self.assertNotIn("n/a", detailed_iterations_data)
|
||||
|
||||
def test_detailed_no_atomic_actions(self):
|
||||
rally = utils.Rally()
|
||||
cfg = {
|
||||
"Dummy.dummy": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 100,
|
||||
"concurrency": 5
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
config = utils.TaskConfig(cfg)
|
||||
rally("task start --task %s" % config.filename)
|
||||
detailed = rally("task detailed")
|
||||
self.assertIn("Dummy.dummy", detailed)
|
||||
detailed_iterations_data = rally("task detailed --iterations-data")
|
||||
self.assertNotIn("n/a", detailed_iterations_data)
|
||||
|
||||
def test_results(self):
|
||||
rally = utils.Rally()
|
||||
|
Loading…
Reference in New Issue
Block a user