-
Notifications
You must be signed in to change notification settings - Fork 131
[6.17.z] Fix httpboot provisioning test #20352
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
Open
Satellite-QE
wants to merge
1
commit into
6.17.z
Choose a base branch
from
cherry-pick-6.17.z-d32fa9b42796d720900f77c6914f3ea1ffa0ce17
base: 6.17.z
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[6.17.z] Fix httpboot provisioning test #20352
Satellite-QE
wants to merge
1
commit into
6.17.z
from
cherry-pick-6.17.z-d32fa9b42796d720900f77c6914f3ea1ffa0ce17
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Shubham Ganar <[email protected]> (cherry picked from commit d32fa9b)
Collaborator
Author
|
trigger: test-robottelo |
Contributor
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:
- The new approach of
time.sleep(20)followed byshell.close()and thenshell.read()is prone to race conditions and may drop buffered output; consider usingwait_foror a polling loop to read from the shell until the expected log line appears (or a timeout), and avoid callingclose()before reading. - The new hard-coded expectation
GET /httpboot/host-config/{host_mac_addr}/grub2/boot.efi with 200assumes a specific log format and path; if this path is derived from configuration elsewhere, it would be safer to construct the expected string from those settings instead of embedding it directly.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new approach of `time.sleep(20)` followed by `shell.close()` and then `shell.read()` is prone to race conditions and may drop buffered output; consider using `wait_for` or a polling loop to read from the shell until the expected log line appears (or a timeout), and avoid calling `close()` before reading.
- The new hard-coded expectation `GET /httpboot/host-config/{host_mac_addr}/grub2/boot.efi with 200` assumes a specific log format and path; if this path is derived from configuration elsewhere, it would be safer to construct the expected string from those settings instead of embedding it directly.
## Individual Comments
### Comment 1
<location> `tests/foreman/api/test_provisioning.py:395-397` </location>
<code_context>
+ host_mac_addr = host_mac_addr.replace(":", "-")
+ shell = sat.session.shell()
shell.send('foreman-tail')
+ time.sleep(20)
shell.close()
- assert_host_logs(shell, f'GET /httpboot/grub2/grub.cfg-{host_mac_addr} with 200')
+ assert f'GET /httpboot/host-config/{host_mac_addr}/grub2/boot.efi with 200' in str(shell.read())
+
# Host should do call back to the Satellite reporting
</code_context>
<issue_to_address>
**suggestion (testing):** Replace fixed sleep with a `wait_for`-style polling to avoid flakiness in detecting the HTTPBoot request.
Previously we used `wait_for` with a 300s timeout to reliably wait for the log entry; this change switches to a single `time.sleep(20)` followed by one read/assert. That’s likely to be flaky on slower or loaded systems. Please wrap the log check in `wait_for` (or an equivalent polling loop) with a reasonable timeout/interval, repeatedly reading until the `GET /httpboot/host-config/{host_mac_addr}/grub2/boot.efi with 200` line appears or the timeout expires, so the test remains stable while still failing if the request never occurs.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Collaborator
Author
|
PRT Result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
6.17.z
Auto_Cherry_Picked
Automatically cherrypicked PR using GHA
AutoMerge_Cherry_Picked
The cherrypicked PRs of master PR would be automerged if all checks passing
No-CherryPick
PR doesnt need CherryPick to previous branches
PRT-Failed
Indicates that latest PRT run is failed for the PR
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherrypick of PR: #19906
Fix httpboot provisioning test failing due to BoxKeyError