Skip to content

test(machine-controller): move machine setup test from api-core#2646

Open
poroh wants to merge 1 commit into
NVIDIA:mainfrom
poroh:tests-refactoring-p14
Open

test(machine-controller): move machine setup test from api-core#2646
poroh wants to merge 1 commit into
NVIDIA:mainfrom
poroh:tests-refactoring-p14

Conversation

@poroh

@poroh poroh commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Move the OEM manager profile forwarding regression test into the machine controller crate and add local test defaults needed to run it there.

Related issues

#2001

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

@poroh poroh requested a review from a team as a code owner June 16, 2026 16:36
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3e0b0d88-1931-472f-b018-87bb2325bf04

📥 Commits

Reviewing files that changed from the base of the PR and between 4d8ed5a and 762ad0d.

📒 Files selected for processing (8)
  • crates/api-core/src/test_support/default_config.rs
  • crates/api-core/src/tests/mod.rs
  • crates/machine-controller/Cargo.toml
  • crates/machine-controller/src/config/controller.rs
  • crates/machine-controller/src/config/firmware_global.rs
  • crates/machine-controller/src/config/mod.rs
  • crates/machine-controller/src/handler.rs
  • crates/machine-controller/src/handler/test_machine_setup.rs
💤 Files with no reviewable changes (1)
  • crates/api-core/src/tests/mod.rs
✅ Files skipped from review due to trivial changes (2)
  • crates/machine-controller/Cargo.toml
  • crates/machine-controller/src/handler.rs
🚧 Files skipped from review as they are similar to previous changes (5)
  • crates/api-core/src/test_support/default_config.rs
  • crates/machine-controller/src/config/controller.rs
  • crates/machine-controller/src/config/firmware_global.rs
  • crates/machine-controller/src/config/mod.rs
  • crates/machine-controller/src/handler/test_machine_setup.rs

Summary by CodeRabbit

Release Notes

  • Refactor
    • Streamlined test configuration defaults by adding unified test_default() constructors for machine state controller, firmware global, and machine state handler site settings.
  • Tests
    • Improved test reliability by extending test-only defaults to run in both test builds and when test support is enabled.
    • Updated test module setup and fixtures to use the new defaults, including simulator setup adjustments for deterministic behavior.

Walkthrough

The PR introduces test_default() factory constructors on MachineStateControllerConfig and MachineStateHandlerSiteConfig, both gated behind #[cfg(any(test, feature = "test-support"))]. The same cfg guard is widened on two FirmwareGlobal helpers. The machine_setup test is relocated from api-core into machine-controller, with call sites updated to consume the new factories.

Changes

Test Config Factories and Test Migration

Layer / File(s) Summary
New test_default() config factories
crates/machine-controller/src/config/controller.rs, crates/machine-controller/src/config/mod.rs, crates/machine-controller/src/config/firmware_global.rs
MachineStateControllerConfig::test_default() and MachineStateHandlerSiteConfig::test_default() are added under #[cfg(any(test, feature = "test-support"))]. FirmwareGlobal::test_default() and FirmwareGlobal::get_retry_interval() widen their cfg guard from feature = "test-support" to any(test, feature = "test-support").
Test relocation and call-site updates
crates/machine-controller/Cargo.toml, crates/machine-controller/src/handler.rs, crates/machine-controller/src/handler/test_machine_setup.rs, crates/api-core/src/tests/mod.rs, crates/api-core/src/test_support/default_config.rs
carbide-redfish is added as a dev-dependency with test-support. The test_machine_setup module is declared in handler.rs under #[cfg(test)]. The test file is refactored to use MachineStateHandlerSiteConfig::test_default() with module-scope imports and a direct &config argument. The machine_setup module declaration is removed from api-core, and default_config.rs delegates to MachineStateControllerConfig::test_default().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the primary change: relocating a regression test from api-core to machine-controller crate.
Description check ✅ Passed The description clearly explains the purpose of moving the test and mentions the addition of local test defaults, directly relating to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Move the OEM manager profile forwarding regression test into the machine
controller crate and add local test defaults needed to run it there.

Signed-off-by: Dmitry Porokh <dporokh@nvidia.com>
@poroh poroh force-pushed the tests-refactoring-p14 branch from 4d8ed5a to 762ad0d Compare June 16, 2026 16:39
@poroh poroh enabled auto-merge (squash) June 16, 2026 16:44
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

🔍 Container Scan Summary

Service Total Critical High Medium Low Other
boot-artifacts-aarch64 3 0 0 3 0 0
boot-artifacts-x86_64 3 0 0 3 0 0
forge-admin-cli-x86_64 244 4 22 103 6 109
machine-validation-runner 671 23 178 262 37 171
machine_validation 671 23 178 262 37 171
nvmetal-carbide 671 23 178 262 37 171
TOTAL 2263 73 556 895 117 622

Per-CVE detail lives in the per-service grype-* artifacts (JSON + SARIF). Severity counts only — no CVE IDs published here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant