fix(api-core): repair a silently-passing state assertion and the ignored rack tests#2716
Conversation
…red rack tests `test_state_outcome` asserted `matches!(host_machine.current_state(), _expected_state)`. In pattern position `_expected_state` is an irrefutable binding, not a comparison against the value built just above it -- so the assertion passed for any state and tested nothing. It now asserts equality against that value, and a stray `dbg!` is removed. The four rack state-controller tests were bare `#[ignore]`, so they never ran in CI. `test_expected_zero_topology_transitions_to_discovering` was only broken by a duplicate `db_rack::create` in its setup -- the second call, mislabeled as "simulating linked trays," just re-created the same rack -- so with that removed it passes and is re-enabled. The other three assert `Created`/`Discovering` transitions the handler does not currently make; rather than leave them silently dead, each now carries an `#[ignore = "..."]` reason and is tracked in NVIDIA#2715 to decide handler-fix versus stale-test per case. The rack-handler and machine-states tests run green: 44 pass, 3 explicitly ignored (down from 4 silently ignored), 0 fail. Signed-off-by: Chet Nichols III <chetn@nvidia.com>
|
@coderabbitai PTAL, thanks! |
|
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. |
|
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 (2)
Summary by CodeRabbit
WalkthroughTwo test files are updated: ChangesTest Assertion Hardening and Ignore Annotation Cleanup
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Fetch PR details
gh pr view 2716 --repo NVIDIA/infra-controller --json title,body,files,additions,deletions
echo "---FILES CHANGED---"
gh pr diff 2716 --repo NVIDIA/infra-controllerLength of output: 6387
|
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
Wave 1 of the carbide-test-support integration (#2692).
Two real test-coverage holes in api-core:
machine_states::test_state_outcomeassertedmatches!(host_machine.current_state(), _expected_state)-- an irrefutable binding, so it passed for any state and tested nothing. Now asserts equality against theexpected_statevalue it builds; straydbg!removed.#[ignore](never ran in CI).test_expected_zero_topology_transitions_to_discoveringwas only broken by a duplicatedb_rack::createin its setup (the second call, mislabeled "simulating linked trays," just re-created the rack) -- fixed and re-enabled.The other three formerly-ignored tests assert
Created/Discoveringtransitions the handler does not currently make. Rather than leave them silently dead, each now carries an#[ignore = "..."]reason and is tracked in #2715 (handler-fix vs stale-test, per test). This converts 4 invisible dead tests into 1 live test + 3 documented-and-tracked ones.Verified: rack-handler + machine-states tests run green (44 pass, 3 explicitly ignored, 0 fail).
Addresses #2694. Surfaced follow-up: #2715.