-
Notifications
You must be signed in to change notification settings - Fork 127
Handle manifest upload for DEFAULT_ORG in case it was already uploaded by other test cases #19915
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
base: master
Are you sure you want to change the base?
Handle manifest upload for DEFAULT_ORG in case it was already uploaded by other test cases #19915
Conversation
…d by other test cases
…d by other test cases
for more information, see https://pre-commit.ci
trigger: test-robottelo |
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.
Hey there - I've reviewed your changes - here's some feedback:
- Rather than catching TaskFailedError and matching on its message, use the Satellite API to check if the manifest already exists before calling upload_manifest, so you avoid brittle string matching.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Rather than catching TaskFailedError and matching on its message, use the Satellite API to check if the manifest already exists before calling upload_manifest, so you avoid brittle string matching.
## Individual Comments
### Comment 1
<location> `tests/foreman/cli/test_rhcloud_inventory.py:811-813` </location>
<code_context>
+ status = target_sat.execute('cat /etc/systemd/system/rhcd.service.d/proxy.conf')
# Check the correct format is present
- assert f'Environment=NO_PROXY={module_target_sat.hostname}' in status.stdout
+ assert f'Environment=NO_PROXY={target_sat.hostname}' in status.stdout
# Ensure NO_PROXY doesn't contain https:// prefix
assert 'Environment=NO_PROXY=https://' not in status.stdout
</code_context>
<issue_to_address>
**suggestion (testing):** Consider parametrizing organization and manifest upload scenarios.
Parametrizing the test to cover both manifest upload states will help ensure all logic branches are tested and reduce the risk of regressions.
Suggested implementation:
```python
import pytest
@pytest.mark.parametrize(
"organization,manifest_uploaded",
[
("org1", True),
("org2", False),
]
)
def test_rhcloud_inventory_proxy_config(target_sat, organization, manifest_uploaded):
# Setup organization and manifest upload state
target_sat.set_organization(organization)
if manifest_uploaded:
target_sat.upload_manifest()
else:
target_sat.remove_manifest()
# Verify the job completed successfully
result = target_sat.api.JobInvocation(id=result.id).read()
assert result.status_label == 'succeeded'
# Read the rhcd service proxy configuration file to verify correct setup
status = target_sat.execute('cat /etc/systemd/system/rhcd.service.d/proxy.conf')
# Check the correct format is present
assert f'Environment=NO_PROXY={target_sat.hostname}' in status.stdout
# Ensure NO_PROXY doesn't contain https:// prefix
assert 'Environment=NO_PROXY=https://' not in status.stdout
```
- You may need to adjust the setup logic for organization and manifest upload to match your actual API and helper methods.
- Ensure that `target_sat.set_organization`, `target_sat.upload_manifest`, and `target_sat.remove_manifest` exist or are implemented as needed.
- If the test function signature or fixture usage differs, adapt the parameterization accordingly.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@jnagare-redhat |
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
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, let's see how PRT goes.
PRT Result
|
trigger: test-robottelo |
yes started full module |
PRT Result
|
I think you also need to update the |
…etting failure in jenkin pipeline
…telo into manifest_upload_fix
trigger: test-robottelo |
PRT Result
|
trigger: test-robottelo |
PRT Result
|
Problem Statement
While running this test case in pipeline, it was throwing TaskFailedError as manifest was already getting uploaded by some other test case.
Solution
module_target_sat to target_sat
as per suggestion from @amolpati30Related Issues
PRT test Cases example
trigger: test-robottelo
pytest: tests/foreman/cli/test_rhcloud_inventory.py -k test_positive_config_on_sat_without_network_protocol