Skip to content

parity: add LCOW document permutation tests#2631

Open
shreyanshjain7174 wants to merge 1 commit intomicrosoft:mainfrom
shreyanshjain7174:parity/lcow-permutations
Open

parity: add LCOW document permutation tests#2631
shreyanshjain7174 wants to merge 1 commit intomicrosoft:mainfrom
shreyanshjain7174:parity/lcow-permutations

Conversation

@shreyanshjain7174
Copy link
Copy Markdown
Contributor

@shreyanshjain7174 shreyanshjain7174 commented Mar 16, 2026

Extends the LCOW parity test infrastructure from #2629 with permutation tests that exercise annotation and option combinations triggering different document construction branches in the legacy and v2 pipelines.

19 permutation tests covering: CPU partial combinations (count-only, limit-only, weight-only), memory (overcommit disabled, cold discard hint), boot mode (kernel direct + VHD rootfs), feature flags (scratch encryption + disabled writable shares, writable overlay dirs), device interactions (VPMem disabled triggers 4 SCSI controllers), cross-group (physically backed + VPMem disabled + scratch encryption, full CPU + memory + MMIO + QoS + cold discard + VHD boot), shim option overrides (annotation CPU/memory overriding shim option values), kernel args (VPCIEnabled + custom boot options, time sync + process dump + writable overlay, initrd boot whitespace quirk).

3 gap tests documenting known v2 builder differences using inverted assertions — they expect a diff and fail only if documents unexpectedly match: nil vs empty CpuGroup, nil vs empty StorageQoS, VPMem controller allocation on initrd boot.

Added normalizeKernelCmdLine and isOnlyKernelCmdLineWhitespaceDiff helpers. 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, we warn instead of failing.

func isOnlyKernelCmdLineWhitespaceDiff(legacy, v2 *hcsschema.ComputeSystem) bool {
legacyCopy := *legacy
v2Copy := *v2
if legacyCopy.VirtualMachine != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could've been a helper, that returns a copy. also, can't we just json marshal/unmarshal?

Add permutation tests exercising annotation and option combinations
that trigger different document construction branches in the legacy
and v2 pipelines.

Permutation tests cover: CPU partial combinations (count-only,
limit-only, weight-only), memory (overcommit disabled, cold discard
hint, deferred commit, non-aligned size), boot mode (kernel direct +
VHD rootfs, UEFI, UEFI + VHD), feature flags (scratch encryption +
disabled writable shares, writable overlay dirs, policy-based
routing), cross-group interactions (physically backed + scratch
encryption, full CPU + memory + MMIO + QoS + cold discard + VHD
boot), shim option overrides (annotation CPU/memory overriding shim
option values, default container annotations), kernel args (VPCI +
custom boot options, time sync + process dump + writable overlay,
initrd boot whitespace quirk, dump directory path), HvSocket (extra
VSock ports).

Error path tests verify both pipelines reject the same invalid inputs.

Non-default sandbox options tests verify SandboxOptions field parity
when annotations set non-default values.

Gap tests document known v2 builder differences using inverted
assertions (shim log level propagation, console pipe formatting).

Add normalizeKernelCmdLine and deepCopyDoc (JSON round-trip) helpers
for whitespace-only diff detection.

Signed-off-by: Shreyanshjain7174 <shreyanshjain7174@gmail.com>
Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>
@shreyanshjain7174 shreyanshjain7174 force-pushed the parity/lcow-permutations branch from 17e6869 to 8e06a52 Compare April 24, 2026 08:28
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.

4 participants