diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f810a5..43fb027 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Calendar Versioning](https://calver.org).
### Added - Return code for report command - Report command option for downloading logs only for non-passed tests +- `--showarch` option in `report` command displaying architecture in the table ### Changed - `-c/--compose` to `-t/--target` diff --git a/README.md b/README.md index 6aa0d19..ed221f9 100644 --- a/README.md +++ b/README.md @@ -206,12 +206,13 @@ Corresponding return code is set based on the results with following logic: ```shell ❯ tesar report --help -usage: tesar report [-h] [-l2] [-s] [-stn SPLIT_TESTNAME] [-spn SPLIT_PLANNAME] [-w] [-d] [--skip-pass] [-lt | -f FILE | -c CMD] +usage: tesar report [-h] [--showarch] [-l2] [-s] [-stn SPLIT_TESTNAME] [-spn SPLIT_PLANNAME] [-w] [-d] [--skip-pass] [-lt | -f FILE | -c CMD] Parses task IDs, Testing Farm artifact URLs or Testing Farm API request URLs from multiple sources. options: -h, --help show this help message and exit + --showarch Display architecture. By default the architecture is not shown. -l2, --level2 Display test view detail. By default the report shows only plan view. -s, --short Display short test and plan names. -stn SPLIT_TESTNAME, --split-testname SPLIT_TESTNAME diff --git a/src/dispatch/__init__.py b/src/dispatch/__init__.py index 5c00050..4092572 100644 --- a/src/dispatch/__init__.py +++ b/src/dispatch/__init__.py @@ -254,6 +254,11 @@ def get_arguments(args=None): description="Parses task IDs, Testing Farm artifact URLs or Testing Farm API request URLs from multiple sources.", ) + report.add_argument( + "--showarch", + action="store_true", + help="""Display architecture. By default the architecture is not shown.""", + ) report.add_argument( "-l2", "--level2", diff --git a/src/report/__main__.py b/src/report/__main__.py index e462099..196fb25 100644 --- a/src/report/__main__.py +++ b/src/report/__main__.py @@ -123,6 +123,7 @@ def parse_request_xunit(request_url_list=None, tasks_source=None, skip_pass=Fals request_state = request.json()["state"].upper() request_uuid = request.json()["id"] request_target = request.json()["environments_requested"][0]["os"]["compose"] + request_arch = request.json()["environments_requested"][0]['arch'] request_datetime_created = request.json()["created"] request_datetime_parsed = request_datetime_created.split(".")[0] @@ -209,6 +210,7 @@ def parse_request_xunit(request_url_list=None, tasks_source=None, skip_pass=Fals if request_uuid not in parsed_dict: parsed_dict[request_uuid] = { "target_name": request_target, + "arch": request_arch, "testsuites": [], } @@ -277,7 +279,10 @@ def build_table(): result_table = PrettyTable() # prepare field names fields = [] - fields += ["UUID", "Target", "Test Plan"] + fields += ["UUID", "Target"] + if ARGS.showarch: + fields += ["Arch"] + fields += ["Test Plan"] if ARGS.level2: fields += ["Test Case"] fields += ["Result"] @@ -298,11 +303,14 @@ def build_table(): if ARGS.split_planname: planname_split_index = ARGS.split_planname - def _gen_row(uuid="", target="", testplan="", testcase="", result=""): + + def _gen_row(uuid="", target="", arch="", testplan="", testcase="", result=""): if "UUID" in fields: yield uuid if "Target" in fields: yield target + if "Arch" in fields: + yield arch if "Test Plan" in fields: yield testplan if "Test Case" in fields: @@ -314,7 +322,7 @@ def add_row(*args, **kwargs): result_table.add_row(tuple(_gen_row(*args, **kwargs))) for task_uuid, data in parsed_dict.items(): - add_row(task_uuid, data["target_name"]) + add_row(task_uuid, data["target_name"], data["arch"]) for testsuite_data in data["testsuites"]: testsuite_name_raw = testsuite_data["testsuite_name"].split("/") testsuite_name_raw.remove("")