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

[RHELC-1193] Identify highest status in json report #983

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

pr-watson
Copy link
Contributor

This PR adds a function find_highest_report_level to report.py to get the highest status level within the results and messages reported in the analysis. This highest status level is added as a new key to the report json at the top level for use in the rhc worker script.

Jira Issues: RHELC-1193

Checklist

  • PR has been tested manually in a VM (either author or reviewer)
  • Jira issue has been made public if possible
  • [RHELC-] is part of the PR title
  • GitHub label has been added to help with Release notes
  • PR title explains the change from the user's point of view
  • Code and tests are documented properly
  • The commits are squashed to as few commits as possible (without losing data)
  • When merged: Jira issue has been updated to Release Pending if relevant

@pr-watson pr-watson added kind/feature New feature or request tests/all Run the full test suite. Equivalent to `/packit test`. labels Nov 15, 2023
@has-bot
Copy link
Member

has-bot commented Nov 15, 2023

/packit test


@oamg/conversions-qe please review results and provide ack.

Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (6b38b7b) 94.20% compared to head (6d280fe) 94.18%.
Report is 1 commits behind head on main.

Files Patch % Lines
...t2rhel/actions/pre_ponr_changes/handle_packages.py 50.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #983      +/-   ##
==========================================
- Coverage   94.20%   94.18%   -0.03%     
==========================================
  Files          47       47              
  Lines        4368     4383      +15     
  Branches      774      779       +5     
==========================================
+ Hits         4115     4128      +13     
  Misses        177      177              
- Partials       76       78       +2     
Flag Coverage Δ
centos-linux-7 89.15% <86.66%> (-0.01%) ⬇️
centos-linux-8 90.21% <86.66%> (-0.02%) ⬇️
centos-linux-9 90.27% <86.66%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

assert result == expected


def test_find_highest_report_level_unknown_status():
Copy link
Member

Choose a reason for hiding this comment

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

Maybe I would use the pytest.mark.parametrize for easier addition of new cases. But question is if that would be ever needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Likely won't have new cases. Just having FOO as an unknown status satisfies checking that unknown statuses will not be added to our output

Copy link
Member

Choose a reason for hiding this comment

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

agreed with @pr-watson. Can't see a case where we would need to parametrize this.

@pr-watson pr-watson force-pushed the highest-status branch 2 times, most recently from ffa4686 to 9874d35 Compare November 16, 2023 20:27
@pr-watson
Copy link
Contributor Author

pr-watson commented Nov 17, 2023

/packit retest-failed

@Venefilyn Venefilyn changed the title [RHELC-1193] Idenitify highest status in json report [RHELC-1193] Identify highest status in json report Nov 24, 2023
@@ -0,0 +1,150 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/oamg/convert2rhel/main/schemas/assessment-schema-1.0.json",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"$id": "https://raw.githubusercontent.com/oamg/convert2rhel/main/schemas/assessment-schema-1.0.json",
"$id": "https://raw.githubusercontent.com/oamg/convert2rhel/main/schemas/assessment-schema-1.1.json",

schemas/assessment-schema-1.1.json Show resolved Hide resolved
# Use an envelope so we can add other, non-result info if necessary.
envelope = {
"format_version": "1.0",
"format_version": "1.1",
Copy link
Member

Choose a reason for hiding this comment

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

Why do we add the format_version here and not using the one in the schema file?

Comment on lines 276 to 281
they come.
"""
Copy link
Member

Choose a reason for hiding this comment

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

Please, if you can, update the docstring to include the param/type/return/rtype.

Suggested change
they come.
"""
they come.
:param results: ...
:type results: ...
:return: ...
:rtype: ...
"""

"const": "1.0"
},
"status": {
"description": "The highest severity of all actions.",
Copy link
Member

Choose a reason for hiding this comment

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

Maybe not necessary, but I would include "between messages and results" in this description

Copy link
Member

@r0x0d r0x0d left a comment

Choose a reason for hiding this comment

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

It looks good to me. Just left a couple of questions and I think one of @SpyTec comments is necessary to apply. Not approving it yet, but I can see the PR is correct.

@pr-watson
Copy link
Contributor Author

@r0x0d just added the requested suggestions, ready for another round of review

@pr-watson
Copy link
Contributor Author

/packit test

@Venefilyn
Copy link
Member

/packit build

@pr-watson
Copy link
Contributor Author

/packit retest-failed

@Venefilyn
Copy link
Member

/packit test

1 similar comment
@pr-watson
Copy link
Contributor Author

/packit test

@pr-watson pr-watson added tests/sanity PR ready to run the sanity test suit. Equivalent to `/packit test --labels sanity`. and removed tests/all Run the full test suite. Equivalent to `/packit test`. labels Nov 30, 2023
@has-bot
Copy link
Member

has-bot commented Nov 30, 2023

/packit test --labels sanity


@oamg/conversions-qe please review results and provide ack.

@pr-watson
Copy link
Contributor Author

/packit test --labels sanity

1 similar comment
@pr-watson
Copy link
Contributor Author

/packit test --labels sanity

@pr-watson
Copy link
Contributor Author

/packit test --labels sanity

@pr-watson pr-watson merged commit 6887c88 into oamg:main Dec 5, 2023
15 of 46 checks passed
@pr-watson pr-watson mentioned this pull request Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request tests/sanity PR ready to run the sanity test suit. Equivalent to `/packit test --labels sanity`.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants