fix: Validate that both DPF and VMAAS are not enabled at the same time. - #4477
fix: Validate that both DPF and VMAAS are not enabled at the same time.#4477abvarshney-nv wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
Walkthrough
ChangesStartup validation
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
crates/api-core/src/setup.rs (2)
212-218: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winRun the conflict check before constructing runtime pools.
start_runtimeconstructs both Redfish pools before this guard. If either constructor performs I/O, allocates a resource, or returns an unrelated error, the invalid configuration can partially initialize runtime state or report the wrong startup error. Move the guard before both constructors, or verify that they are side-effect-free and cannot mask this validation.As per path instructions, prioritize behavior and resource-lifetime findings over style-only findings.
🤖 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/src/setup.rs` around lines 212 - 218, Move the VMaaS/DPF conflict validation using the existing eyre::ensure! check to the beginning of start_runtime, before either Redfish runtime pool is constructed. Ensure invalid configurations return the conflict error before any pool initialization, I/O, allocation, or unrelated constructor failure can occur.Source: Path instructions
212-218: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd table-driven coverage for the configuration combinations.
Test DPF enabled and disabled with
vmaas_configabsent and present. Assert that only(dpf.enabled = true, vmaas_config = Some(_))returns an error. Extract the validation predicate if constructingstart_runtimerequires external resources.As per coding guidelines, mappings from inputs to outputs or errors must use table-driven tests.
🤖 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/src/setup.rs` around lines 212 - 218, Add table-driven tests for the configuration validation surrounding the DPF/VMaaS ensure, covering both values of dpf.enabled and both absent and present vmaas_config; assert that only enabled DPF with Some(vmaas_config) produces an error. If testing start_runtime requires external resources, extract the validation predicate into a testable symbol and exercise that predicate instead.Source: Coding guidelines
🤖 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.
Inline comments:
In `@crates/api-core/src/setup.rs`:
- Line 217: Update the startup error message in the VMaaS/DPF configuration
validation to use lowercase wording and remove the trailing period, while
preserving the existing meaning.
---
Nitpick comments:
In `@crates/api-core/src/setup.rs`:
- Around line 212-218: Move the VMaaS/DPF conflict validation using the existing
eyre::ensure! check to the beginning of start_runtime, before either Redfish
runtime pool is constructed. Ensure invalid configurations return the conflict
error before any pool initialization, I/O, allocation, or unrelated constructor
failure can occur.
- Around line 212-218: Add table-driven tests for the configuration validation
surrounding the DPF/VMaaS ensure, covering both values of dpf.enabled and both
absent and present vmaas_config; assert that only enabled DPF with
Some(vmaas_config) produces an error. If testing start_runtime requires external
resources, extract the validation predicate into a testable symbol and exercise
that predicate instead.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: faef39db-0100-46ee-b637-64b662625563
📒 Files selected for processing (1)
crates/api-core/src/setup.rs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Abhishek Varshney <abvarshney@nvidia.com>
Validate that both DPF and VMAAS are not enabled at the same time.
Related issues
Type of Change
Breaking Changes
Testing
Additional Notes