test(api-core): move firmware upgrade coverage to integration suites#3079
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Dmitry Porokh <[email protected]>
1bcb719 to
eebb855
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/api-core/tests/integration/scout_firmware_upgrade_status.rs (1)
200-233: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winTighten the truncation boundary assertion.
assert!(result.stdout.len() <= 1500)only proves the output isn't too long — it would pass even if truncation were broken and returned an empty string. Since the handler'sMAX_STORED_OUTPUT_SIZEis exactly 1500, assert on the exact boundary to actually exercise the truncation path.🎯 Proposed fix for precise boundary assertions
- assert!(result.stdout.len() <= 1500); - assert!(result.stderr.len() <= 1500); - assert!(result.error.len() <= 1500); + assert_eq!(result.stdout.len(), 1500); + assert_eq!(result.stderr.len(), 1500); + assert_eq!(result.error.len(), 1500);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/api-core/tests/integration/scout_firmware_upgrade_status.rs` around lines 200 - 233, The truncation test in truncates_result_output is too weak because it only checks an upper bound on result.stdout, result.stderr, and result.error. Update the assertions to verify the stored output reaches the exact truncation boundary used by the handler’s MAX_STORED_OUTPUT_SIZE instead of allowing empty or shorter strings to pass. Use truncates_result_output and the result fields from WaitingForScoutUpgrade to locate the test, and make the assertions precise enough to exercise the truncation logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@crates/api-core/tests/integration/scout_firmware_upgrade_status.rs`:
- Around line 200-233: The truncation test in truncates_result_output is too
weak because it only checks an upper bound on result.stdout, result.stderr, and
result.error. Update the assertions to verify the stored output reaches the
exact truncation boundary used by the handler’s MAX_STORED_OUTPUT_SIZE instead
of allowing empty or shorter strings to pass. Use truncates_result_output and
the result fields from WaitingForScoutUpgrade to locate the test, and make the
assertions precise enough to exercise the truncation logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: f24395ed-4c69-4e85-a0ba-fd6c2787c36f
📒 Files selected for processing (5)
crates/api-core/src/tests/host_bmc_firmware_test.rscrates/api-core/tests/integration/main.rscrates/api-core/tests/integration/scout_firmware_upgrade_status.rscrates/machine-controller/tests/integration/firmware_upgrade_completion.rscrates/machine-controller/tests/integration/main.rs
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
From huge host_bmc_firmware_test:
Move firmware upgrade completion state handling tests to machine controller integration tests.
Move status firmware upgrade status reporting API tests to api-core integration tests.
Related issues
#2001
Type of Change
Breaking Changes
Testing
Additional Notes