Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pending state for results #3485

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add pending state for results #3485

wants to merge 1 commit into from

Conversation

thrix
Copy link
Collaborator

@thrix thrix commented Jan 26, 2025

Resolves #3304

Pull Request Checklist

  • implement the feature
  • write the documentation
  • extend the test coverage
  • update the specification
  • adjust plugin docstring
  • modify the json schema
  • mention the version
  • include a release note

@thrix thrix added ci | full test Pull request is ready for the full test execution step | discover Stuff related to the discover step step | execute Stuff related to the execute step labels Jan 26, 2025
Resolves #3304

Signed-off-by: Miroslav Vadkerti <[email protected]>
self._results.clear()
for index, result in enumerate(self._results):
if result.result != ResultOutcome.PENDING:
self._results[index] = Result(name=result.name, result=ResultOutcome.PENDING)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say this should recreate the list from scratch, i.e. not overwriting the existing results. Let's say there was a test with custom results, creating 100 of results for that single test. Before running the test for the first time, there would be a single PENDING placeholder for the test; after the operation above, results.yaml may contain 100 results for that test, each with PENDING results. And since tmt does not control creation of these results, the test may easily decide to not produce several of them this time, and therefore that particular result should never appear in our results.yaml. Dropping all results except the single PENDING one per test seems like better option to me.

@@ -415,6 +417,15 @@ def go(self, force: bool = False) -> None:
test.serial_number == result.serial_number):
self._failed_tests[test_phase].append(test)

# Initialize results with pending outcome if no results for it available
results = self.plan.execute.results()
for index, (test, result) in enumerate(zip_longest(self.tests(), results)):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it won't be as easy as zip(). Results may be listed in an arbitrary order - yes, results are added once their tests finish, but I wouldn't rely on it, and there is certainly no code enforcing the order.

Check the Execute.results_for_tests() which lists results and test pairs, you should be interested in creating new results for pairs where the test is set and the result is None, that's a test that has not run yet.

# Go through all results and replace those which were pending
for index, result in enumerate(execute_phases[0].results()):
if self._results[index].result == ResultOutcome.PENDING:
self._results[index] = result
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, this is weird. I think it will hit custom results again: for a single test, there may be 100 results in execute_phases[0].results() but not in `self._results. They would then land all in the very same index.

I believe we need a more robust approach here, based on matching the result's test serial numbers, constructing the list from two sources, execute_phases[0] and self._results. I'd try walking self._results, and find out whether there are any results in execute_phases[0].results()for the same test: if there are, add them to futureself._results, if there are not, copy the pending one. Eventually, I'd expect to be left with consumed execute_phase[0].results(), because all of those are valid results, and possibly not consumed self._resultsbecause some were moved to the new list, and some didn't run and remainPENDING`. Those I would add to the new list as well.

@thrix thrix added this to the 1.43 milestone Jan 27, 2025
@psss
Copy link
Collaborator

psss commented Jan 27, 2025

This pull request covers #3238 as well, right?

@thrix thrix added the priority | must high priority, must be included in the next release label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci | full test Pull request is ready for the full test execution priority | must high priority, must be included in the next release step | discover Stuff related to the discover step step | execute Stuff related to the execute step
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate results.yaml in progress
3 participants