Merge "[Verify] Small improvoments for rally verify show cmd"

This commit is contained in:
Jenkins 2017-01-10 15:43:12 +00:00 committed by Gerrit Code Review
commit 1fc2d31527
2 changed files with 16 additions and 17 deletions

View File

@ -480,8 +480,8 @@ class VerifyCommands(object):
detailed=False):
"""Show a verification."""
verification = api.verification.get(verification_uuid)
verifier = api.verifier.get(verification.verifier_uuid)
# Main Table
def run_args_formatter(v):
run_args = []
for k in sorted(v.run_args):
@ -496,6 +496,12 @@ class VerifyCommands(object):
run_args.append("%s: %s" % (k, value))
return "\n".join(run_args)
# Main table
fields = ["UUID", "Status", "Started at", "Finished at", "Duration",
"Run arguments", "Verifier name", "Verifier type",
"Deployment name", "Tests count", "Tests duration, sec",
"Success", "Skipped", "Expected failures",
"Unexpected success", "Failures"]
formatters = {
"Verifier name": lambda v: verifier.name,
"Verifier type": (
@ -510,22 +516,15 @@ class VerifyCommands(object):
"Run arguments": run_args_formatter,
"Tests duration, sec": lambda v: v.tests_duration
}
fields = ["UUID", "Verifier name", "Verifier type", "Deployment name",
"Started at", "Finished at", "Duration", "Run arguments",
"Tests count", "Tests duration, sec", "Success", "Skipped",
"Expected failures", "Unexpected success", "Failures",
"Status"]
verifier = api.verifier.get(verification.verifier_uuid)
cliutils.print_dict(verification, fields, formatters=formatters,
normalize_field_names=True, print_header=False,
table_label="Verification")
if detailed:
print(_("\nRun arguments:"))
print(json.dumps(verification.run_args, indent=4))
print(json.dumps(verification.run_args, indent=4) + "\n")
# Tests
print("\n")
# Tests table
tests = verification.tests
values = [tests[test_id] for test_id in tests]
fields = ["Name", "Duration, sec", "Status"]

View File

@ -323,11 +323,7 @@ class VerifyCommandsTestCase(test.TestCase):
"--------------------+\n"
"| UUID | uuuiiiiddd "
" |\n"
"| Verifier name | My Verifier "
" |\n"
"| Verifier type | OldSchoolTestTool (namespace: OpenStack) "
" |\n"
"| Deployment name | Some Deploy "
"| Status | success "
" |\n"
"| Started at | 2016-01-01 17:00:03 "
" |\n"
@ -341,6 +337,12 @@ class VerifyCommandsTestCase(test.TestCase):
"splayed separately) |\n"
"| | skip_list: (value is too long, will be di"
"splayed separately) |\n"
"| Verifier name | My Verifier "
" |\n"
"| Verifier type | OldSchoolTestTool (namespace: OpenStack) "
" |\n"
"| Deployment name | Some Deploy "
" |\n"
"| Tests count | 2 "
" |\n"
"| Tests duration, sec | 4 "
@ -355,8 +357,6 @@ class VerifyCommandsTestCase(test.TestCase):
" |\n"
"| Failures | 1 "
" |\n"
"| Status | success "
" |\n"
"+---------------------+------------------------------------------"
"--------------------+\n", print_dict_calls[0].getvalue())