Skip to content

Commit

Permalink
Rename result phase to subresult
Browse files Browse the repository at this point in the history
  • Loading branch information
seberm committed Aug 5, 2024
1 parent 63b1035 commit e6f7ddd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
25 changes: 14 additions & 11 deletions spec/plans/results.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ description: |
# String, the place in test workflow when the check was executed.
event: "before-test"|"after-test"

# Represents results of all test phases, if reported by the test.
# Fields have the same meaning as fields of the "parent" test result, but
# relate to each phase check alone.
phase:
# Represents results of all subtests (aka phases), if reported by the
# test. Fields have the same meaning as fields of the "parent" test
# result, but relate to each test alone.
subresult:
# String, name of the test phase.
- name: First test case

Expand All @@ -122,20 +122,20 @@ description: |

# List of strings, paths to log files.
log:
- path/to/phase/log1.txt
- path/to/phase/log2.log
- path/to/subresult/log1.txt
- path/to/subresult/log2.log
...

# String, when the phase started, in an ISO 8601 format.
# String, when the subtest started, in an ISO 8601 format.
start-time: "yyyy-mm-ddThh:mm:ss.mmmmm+ZZ:ZZ"

# String, when the phase finished, in an ISO 8601 format.
# String, when the subtest finished, in an ISO 8601 format.
end-time: "yyyy-mm-ddThh:mm:ss.mmmmm+ZZ:ZZ"

# String, how long did the phase run.
# String, how long did the subtest run.
duration: hh:mm:ss

# List, results of checks performed for this test phase.
# List, results of checks performed for this subtest.
# It follows the same structure as the `check` key in the
# "parent" test result.
check:
Expand Down Expand Up @@ -177,7 +177,7 @@ description: |

The ``name`` and ``result`` keys are required. Also, ``name``, ``result``,
and ``event`` keys are required for entries under ``check`` key, and
``name`` and ``result`` keys are required for entries under ``phase``
``name`` and ``result`` keys are required for entries under ``subresult``
key. Custom result files may omit all other keys, although tmt plugins
will strive to provide as many keys as possible.

Expand Down Expand Up @@ -221,6 +221,9 @@ description: |
.. versionchanged:: 1.34
phase results are now defined, under the ``phase`` key.

.. versionchanged:: 1.36
phase results are now renamed to the ``subresult`` key.

__ https:/teemtee/tmt/blob/main/tmt/schemas/results.yaml

example:
Expand Down
20 changes: 10 additions & 10 deletions tmt/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ class CheckResult(BaseResult):


@dataclasses.dataclass
class PhaseCheckResult(CheckResult):
class SubCheckResult(CheckResult):
"""
Describes what tmt knows about a single phase test check result.
Describes what tmt knows about a single subtest check result.
It does not contain any additional fields; it simply defines a type to
easily differentiate between a :py:class:`tmt.result.CheckResult` and a
Expand All @@ -147,14 +147,14 @@ class PhaseCheckResult(CheckResult):


@dataclasses.dataclass
class PhaseResult(BaseResult):
""" Describes what tmt knows about a single test phase result (sub-result) """
class SubResult(BaseResult):
""" Describes what tmt knows about a single test subresult """

check: list[PhaseCheckResult] = field(
default_factory=cast(Callable[[], list[PhaseCheckResult]], list),
check: list[SubCheckResult] = field(
default_factory=cast(Callable[[], list[SubCheckResult]], list),
serialize=lambda results: [result.to_serialized() for result in results],
unserialize=lambda serialized: [
PhaseCheckResult.from_serialized(check) for check in serialized]
SubCheckResult.from_serialized(check) for check in serialized]
)


Expand Down Expand Up @@ -182,11 +182,11 @@ class Result(BaseResult):
unserialize=lambda serialized: ResultGuestData.from_serialized(serialized)
)

phase: list[PhaseResult] = field(
default_factory=cast(Callable[[], list[PhaseResult]], list),
subresult: list[SubResult] = field(
default_factory=cast(Callable[[], list[SubResult]], list),
serialize=lambda results: [result.to_serialized() for result in results],
unserialize=lambda serialized: [
PhaseResult.from_serialized(phase) for phase in serialized]
SubResult.from_serialized(subresult) for subresult in serialized]
)

check: list[CheckResult] = field(
Expand Down
6 changes: 3 additions & 3 deletions tmt/schemas/results.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ definitions:
items:
$ref: "/definitions/check_result"

phase_result:
subresult:
type: object
properties:
name:
Expand Down Expand Up @@ -142,8 +142,8 @@ items:
check:
$ref: "/definitions/check_results"

phase:
$ref: "/definitions/phase_results"
subresult:
$ref: "/definitions/subresults"

required:
- name
Expand Down

0 comments on commit e6f7ddd

Please sign in to comment.