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

SCAP report and remediation #1441

Merged
merged 3 commits into from
Aug 28, 2024
Merged

Conversation

lhellebr
Copy link
Contributor

Required by SatelliteQE/robottelo#15491

Also, added limit of rows to read because sometimes you don't need them all and it takes a while to read.

@lhellebr
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_host.py::test_positive_end_to_end

@lhellebr
Copy link
Contributor Author

PRT to check whether limit has caused regression

@lhellebr lhellebr added the No-CherryPick PR doesnt need CherryPick to previous branches label Jun 24, 2024
@lhellebr
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_host.py::test_positive_end_to_end

@Satellite-QE
Copy link
Contributor

PRT Result

Build Number: 308
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_host.py::test_positive_end_to_end --external-logging
Test Result : ================== 1 failed, 9 warnings in 681.62s (0:11:21) ===================

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Jun 25, 2024
@lhellebr
Copy link
Contributor Author

This test wasn't a good choice, it fails in master on stream as well. I'll pick another one.

@lhellebr
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_activationkey.py::test_positive_end_to_end_crud

@Satellite-QE
Copy link
Contributor

PRT Result

Build Number: 309
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_activationkey.py::test_positive_end_to_end_crud --external-logging
Test Result : ================== 1 failed, 10 warnings in 691.84s (0:11:31) ==================

@lhellebr
Copy link
Contributor Author

Ok, this is a true positive, do not merge and I will look into it

@lhellebr
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_activationkey.py::test_positive_end_to_end_crud

@Satellite-QE
Copy link
Contributor

PRT Result

Build Number: 310
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_activationkey.py::test_positive_end_to_end_crud --external-logging
Test Result : ================== 1 passed, 12 warnings in 757.32s (0:12:37) ==================

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels Jun 25, 2024
@lhellebr
Copy link
Contributor Author

Fixed, pls review

@lhellebr lhellebr requested review from a team June 25, 2024 15:27
Copy link
Contributor

@vijaysawant vijaysawant left a comment

Choose a reason for hiding this comment

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

Need to update doc string. Otherwise looks good.

airgun/entities/oscapreport.py Outdated Show resolved Hide resolved
airgun/entities/oscapreport.py Outdated Show resolved Hide resolved
airgun/views/common.py Show resolved Hide resolved
airgun/views/common.py Show resolved Hide resolved
@lhellebr
Copy link
Contributor Author

lhellebr commented Jul 9, 2024

trigger: test-robottelo
pytest: tests/foreman/ui/test_host.py::test_positive_end_to_end tests/foreman/longrun/test_oscap.py::test_positive_oscap_remediation

@Satellite-QE
Copy link
Contributor

PRT Result

Build Number: 311
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_host.py::test_positive_end_to_end tests/foreman/longrun/test_oscap.py::test_positive_oscap_remediation --external-logging
Test Result : ================= 2 passed, 130 warnings in 1480.32s (0:24:40) =================

@lhellebr lhellebr requested a review from vijaysawant July 9, 2024 13:23
@lhellebr
Copy link
Contributor Author

lhellebr commented Jul 9, 2024

@vijaysawant comments addressed

@lhellebr
Copy link
Contributor Author

lhellebr commented Jul 10, 2024

And the "remove PRT" failure is not this PR's fault

@lhellebr lhellebr requested a review from a team July 15, 2024 09:25
@lhellebr
Copy link
Contributor Author

merge

view.wait_displayed()
self.browser.plugin.ensure_page_safe()
wait_for(lambda: view.title.is_displayed, timeout=10, delay=1)
view.fill({'select_remediation_method.snippet': 'Ansible'})

Choose a reason for hiding this comment

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

Ansible is a default value? you could expect some more options there ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what this function does as per docstring: Remediate the failed rule using automatic remediation through Ansible.
It surely can be changed to allow for different methods. On one hand, it's not a goal of this function/test to test various methods of remote execution. On the other hand, there is a wizard specifically for remediation that lets you choose so IMO this will be a good addition, later.

clicking on the link in Reported At column of
SCAP Report list

:param search_string:

Choose a reason for hiding this comment

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

what is this search string ? is this any type of entity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately a link to the correct arf report is in the column Reported At and you get there by clicking the link saying e.g. 1 day ago... so search actually searches by a (not visible) id in the link.
You call it like this:

session.oscapreport.remediate(f'id={arf_id}', title)

@@ -1929,11 +1929,56 @@ def has_rows(self):
return False
return True

def read(self):
def read_limited(self, limit):

Choose a reason for hiding this comment

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

@lhellebr nice addition!


:return: A :py:class:`dict` of ``widget_name: widget_read_value``
where the values are retrieved using the :py:meth:`Widget.read`.
"""
if widget_names is None:
if limit is not None:
raise NotImplementedError("You must specify widgets to be able to specify limit")

Choose a reason for hiding this comment

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

s/widgets/widget_names is that right ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well... you specify widgets by their names

Copy link

@omkarkhatavkar omkarkhatavkar left a comment

Choose a reason for hiding this comment

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

ACK, non-blocking comments

@sambible sambible removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 24, 2024
@lhellebr
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_host.py::test_positive_end_to_end tests/foreman/longrun/test_oscap.py::test_positive_oscap_remediation

@Satellite-QE
Copy link
Contributor

PRT Result

Build Number: 363
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_host.py::test_positive_end_to_end tests/foreman/longrun/test_oscap.py::test_positive_oscap_remediation --external-logging
Test Result : ============ 1 failed, 1 passed, 111 warnings in 1204.78s (0:20:04) ============

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Aug 20, 2024
@lhellebr
Copy link
Contributor Author

So... after this hasn't been merged for 2 MONTHS, there is a seemingly unrelated issue that I will have to investigate. Does it ring a bell?

robottelo.exceptions.CLIReturnCodeError: CLIReturnCodeError(status=70, stderr='Could not update the host:\n  Katello::Resources::Candlepin::Consumer: 404 Not Found {"displayMessage":"Environment with ID \\"74cd9541b1d4a00c20d1e5df73d5eb95\\" could not be found.","requestUuid":"01bd3816-957a-4d12-9c11-fa0953beceab"} (PUT /candlepin/consumers/c3c5db21-f366-48d7-9f60-25f6fa2d914e)\n', msg='Command "host update" finished with status 70\nstderr contains:\nCould not update the host:\n  Katello::Resources::Candlepin::Consumer: 404 Not Found {"displayMessage":"Environment with ID \\"74cd9541b1d4a00c20d1e5df73d5eb95\\" could not be found.","requestUuid":"01bd3816-957a-4d12-9c11-fa0953beceab"} (PUT /candlepin/consumers/c3c5db21-f366-48d7-9f60-25f6fa2d914e)\n'

@lhellebr
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_host.py::test_positive_end_to_end tests/foreman/longrun/test_oscap.py::test_positive_oscap_remediation
robottelo: 16070

@Satellite-QE
Copy link
Contributor

PRT Result

Build Number: 376
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_host.py::test_positive_end_to_end tests/foreman/longrun/test_oscap.py::test_positive_oscap_remediation --external-logging
Test Result : ============ 1 failed, 1 passed, 126 warnings in 1337.22s (0:22:17) ============

@lhellebr
Copy link
Contributor Author

The failure in test_positive_end_to_end is NOT a regression caused by this PR. The same failure appears in the last 6.16 automation.

@lhellebr
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_oscap.py::test_positive_oscap_remediation
robottelo: 16070

@Satellite-QE
Copy link
Contributor

PRT Result

Build Number: 378
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_oscap.py::test_positive_oscap_remediation --external-logging
Test Result : ================= 1 passed, 16 warnings in 1323.01s (0:22:03) ==================

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels Aug 26, 2024
@lhellebr lhellebr requested a review from a team August 27, 2024 08:15
@lhellebr
Copy link
Contributor Author

I'm gonna self-merge in 48 hours unless someone comments here.

@lhellebr
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_oscap.py::test_positive_oscap_remediation tests/foreman/ui/test_activationkey.py::test_positive_end_to_end_crud
robottelo: 16070

@Satellite-QE
Copy link
Contributor

PRT Result

Build Number: 380
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_oscap.py::test_positive_oscap_remediation tests/foreman/ui/test_activationkey.py::test_positive_end_to_end_crud --external-logging
Test Result : ================= 2 passed, 110 warnings in 4061.85s (1:07:41) =================

@lhellebr
Copy link
Contributor Author

We can't merge due to Remove the PRT label failure. I don't think it's caused by this PR. How can I fix it? @SatelliteQE/airgun-tier-2-reviewers ?

@omkarkhatavkar omkarkhatavkar merged commit 73239e4 into SatelliteQE:master Aug 28, 2024
11 of 12 checks passed
lhellebr added a commit that referenced this pull request Sep 2, 2024
* SCAP report and remediation

* Fix missing attribute error when called without limit

* Comments addressed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No-CherryPick PR doesnt need CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants