parity: add LCOW document permutation tests#1
parity: add LCOW document permutation tests#1shreyanshjain7174 wants to merge 1 commit intoparity/lcow-document-testfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a7f0642fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if diff == "" { | ||
| t.Errorf("gap test unexpectedly passed: v2 builder bug may be fixed; remove from gaps") | ||
| } else { | ||
| t.Logf("expected gap diff (-legacy +v2):\n%s", diff) |
There was a problem hiding this comment.
Assert concrete gap fields rather than any mismatch
The gap: branch passes whenever cmp.Diff is non-empty, so these cases no longer verify the documented gaps (CpuGroup, StorageQoS, VirtualPMem) and will also pass if a different regression appears in those scenarios. This makes the test both brittle (it fails when parity improves) and blind to unrelated regressions; tightening the assertion to check for the specific expected field differences would preserve the intended signal.
Useful? React with 👍 / 👎.
Add TestLCOWDocumentParityPermutations to exercise annotation and option combinations that trigger different document construction branches in the legacy and v2 LCOW pipelines. Each test sets all required fields so comparisons check real values rather than defaults. Permutation categories: - CPU partial combinations (count, limit, weight) - Memory (overcommit disabled, cold discard hint) - Boot mode (kernel direct + VHD rootfs) - Feature flags (scratch encryption, writable overlay) - Device interactions (VPMem disabled → 4 SCSI controllers) - Cross-group (physically backed + VPMem + encryption) - Shim option overrides (annotation CPU/memory priority) - Kernel args (VPCIEnabled, time sync, process dump, initrd boot) Gap tests document three known v2 builder differences: - No CPUGroupID: legacy nil vs v2 empty CpuGroup struct - No StorageQoS: legacy nil vs v2 empty StorageQoS struct - Initrd boot: legacy VPMem controller vs v2 nil VirtualPMem Gap tests use inverted assertions — they expect a diff and only fail if documents unexpectedly match, signaling the v2 bug was fixed. Also adds normalizeKernelCmdLine and isOnlyKernelCmdLineWhitespaceDiff helpers to handle a known legacy quirk where initrd+KernelDirect boot produces a leading space in kernel command lines that v2 correctly omits. Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>
6a7f064 to
917d728
Compare
|
Closing: duplicate of microsoft#2631 |
This PR extends the LCOW parity test infrastructure from microsoft#2629 with permutation tests that exercise annotation and option combinations triggering different document construction branches in the legacy and v2 pipelines.
Changes
Permutation tests (
TestLCOWDocumentParityPermutations)19 test cases covering:
Gap tests
3 tests documenting known v2 builder differences using inverted assertions (they expect a diff and only fail if the documents unexpectedly match):
CpuGroup = nilCpuGroup = &{Id:""}StorageQoS = nilStorageQoS = &{}VirtualPMem = nilThese are tracked for fixes in the v2 builder (see microsoft#2630).
Kernel cmdline whitespace handling
Added
normalizeKernelCmdLineandisOnlyKernelCmdLineWhitespaceDiffhelpers. The legacy builder produces a leading space in kernel command lines for initrd+KernelDirect boot that the v2 builder correctly omits. Since HCS trims whitespace, this difference is harmless and we warn instead of failing.Testing
Requires admin PowerShell + Hyper-V enabled (tests call
processorinfo.HostProcessorInfovia HCS).Depends on