-
Notifications
You must be signed in to change notification settings - Fork 115
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
policy list should work after associated hg removal #15031
Conversation
|
PRT Result
|
Disregard the prt run, the test collection there didn't match my comment, so I killed the job, investigating... |
|
PRT Result
|
tests/foreman/cli/test_oscap.py
Outdated
try: | ||
module_target_sat.cli.Scappolicy.list() | ||
except CLIReturnCodeError: | ||
pytest.fail("failed to list policies") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we catching the failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that plain raising of the exception results in Error
junit status. If you properly fail it, you get Failed
status.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, CLIReturnCodeError
doesn't inherit from AssertionError
so the test would result as Error
. And unfortunately pytest doesn't have anything like pytest.not_raises()
(yet), which would be cool for these cases.
tests/foreman/cli/test_oscap.py
Outdated
module_target_sat.cli.HostGroup.delete({'id': hostgroup['id']}) | ||
# removal of hostgroup shouldn't affect policies | ||
try: | ||
module_target_sat.cli.Scappolicy.list() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you assert the policies have indeed been listed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK after adressing @lhellebr 's comment
tests/foreman/cli/test_oscap.py
Outdated
try: | ||
module_target_sat.cli.Scappolicy.list() | ||
except CLIReturnCodeError: | ||
pytest.fail("failed to list policies") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that plain raising of the exception results in Error
junit status. If you properly fail it, you get Failed
status.
I would also add some assertion like @lhellebr mentioned. |
|
PRT Result
|
|
PRT Result
|
trigger: test-robottelo |
PRT Result
|
|
||
:expectedresults: The policy is created and associated successfully. | ||
Policies can be listed after hostgroup removal. | ||
|
||
:bz: 1728157 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:bz: 1728157 | |
:bz: 1728157 | |
:Verifies: SAT-19502 |
@pondrejk As we're moving away from Bugzilla, could we also add Jira issue here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, one minor comment left.
co-reviewed with @jameerpathan111
tests/foreman/cli/test_oscap.py
Outdated
# removal of hostgroup shouldn't affect policies | ||
try: | ||
result = module_target_sat.cli.Scappolicy.list() | ||
assert name in [policy['name'] for policy in result] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor one: since CLIReturnCodeError can not be raised here, you can move this line below the except block.
Edit: commenting on line assert name in [policy['name'] for policy in result]
trigger: test-robottelo |
1 similar comment
trigger: test-robottelo |
PRT Result
|
Problem Statement
SAT-19502 describes the issue, https://github.com/theforeman/foreman_openscap/pull/568/files provides the upstream fix
Solution
Extending an existing test to check the policy behavior after hostgroup removal
Related Issues