Virt: Fix timeout in run_os_command for Windows operations#3746
Virt: Fix timeout in run_os_command for Windows operations#3746SiboWang1997 wants to merge 1 commit intoRedHatQE:mainfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR adds a new TIMEOUT_30SEC constant and makes SSH timeouts configurable: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3746 +/- ##
==========================================
+ Coverage 98.63% 98.65% +0.02%
==========================================
Files 25 25
Lines 2420 2459 +39
==========================================
+ Hits 2387 2426 +39
Misses 33 33
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
utilities/virt.py (1)
2666-2678: 🧹 Nitpick | 🔵 TrivialMEDIUM: Use explicit numeric value
30for the default timeout.The function signature and implementation are correct, but per team convention, use the explicit numeric value rather than the
TIMEOUT_30SECconstant.The ProxyCommandFailure handling for reboot commands is appropriate — the SSH connection naturally drops during a successful reboot, so returning
Noneis the expected behavior.♻️ Proposed fix to use explicit numeric value
-def run_os_command(vm: VirtualMachineForTests, command: str, timeout: int = TIMEOUT_30SEC) -> Optional[str]: +def run_os_command(vm: VirtualMachineForTests, command: str, timeout: int = 30) -> Optional[str]: try: return run_ssh_commands( host=vm.ssh_exec, commands=shlex.split(command), timeout=timeout, tcp_timeout=TCP_TIMEOUT_30SEC, )[0] except ProxyCommandFailure: # On RHEL on successful reboot command execution ssh gets stuck if "reboot" not in command: raise return NoneBased on learnings: "In the openshift-virtualization-tests repository, the team has decided to avoid using predefined time constants (like TIMEOUT_2MIN, TIMEOUT_5SEC) and prefers using explicit numeric values for timeout parameters."
🤖 Fix all issues with AI agents
In `@utilities/virt.py`:
- Line 87: The import and use of the TIMEOUT_30SEC constant should be replaced
with an explicit numeric value; update references to TIMEOUT_30SEC in
utilities/virt.py to use the integer 30 directly (e.g., where TIMEOUT_30SEC is
passed as a timeout parameter), and remove the TIMEOUT_30SEC import from the
module to avoid unused imports; ensure any function calls or defaults (e.g.,
functions that accept timeout args) now pass 30 instead of TIMEOUT_30SEC.
|
/build-and-push-container |
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-3746 published |
29af0bd to
c0a438c
Compare
|
/verified |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Your deliverable: Test Execution Plan
Guidelines:
Hardware-Related Checks (SR-IOV, GPU, DPDK): When PR modifies fixtures for hardware-specific resources:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 5753 🧠 Learnings used |
|
/lgtm |
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #4041. Overlapping filesutilities/virt.py |
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #3847. Overlapping filesutilities/virt.py |
|
/approve |
|
/verified |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Your deliverable: Test Execution Plan
Guidelines:
Hardware-Related Checks (SR-IOV, GPU, DPDK): When PR modifies fixtures for hardware-specific resources:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 2890 🏁 Script executed: Length of output: 1735 🧠 Learnings used |
|
/lgtm |
|
/approve |
|
/verified |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Your deliverable: Test Execution Plan
Guidelines:
Hardware-Related Checks (SR-IOV, GPU, DPDK): When PR modifies fixtures for hardware-specific resources:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 5142 🧠 Learnings used |
|
/approve |
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #3755. Overlapping filesutilities/virt.py |
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #4159. Overlapping filesutilities/virt.py |
|
Clean rebase detected — no code changes compared to previous head ( |
|
Clean rebase detected — no code changes compared to previous head ( |
Windows service operations like Stop-Service can take 10-20 seconds to complete, causing test_vmi_guest_agent_info_after_guest_reboot to fail with TimeoutError. Add os_type parameter to run_os_command and use 30-second timeout for Windows operations while preserving default 5-second timeout for other systems. Signed-off-by: Sibo Wang <siwang@redhat.com>
|
Clean rebase detected — no code changes compared to previous head ( |
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #4404. Overlapping filesutilities/virt.py |
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #4463. Overlapping filesutilities/virt.py |
Short description:
Windows service operations like Stop-Service can take 10-20 seconds to complete, causing tests such as
test_vmi_guest_agent_info_after_guest_rebootto fail with TimeoutError. Increase default SSH timeout from 5 to 30 seconds while maintaining backward compatibility.More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
jira-ticket:
Summary by CodeRabbit
Bug Fixes
Refactor