Skip to content

test: add LCOWV2 feature flag and v2 LCOW test surface#2747

Open
shreyanshjain7174 wants to merge 2 commits into
microsoft:mainfrom
shreyanshjain7174:test/lcow-v2-feature-flag
Open

test: add LCOWV2 feature flag and v2 LCOW test surface#2747
shreyanshjain7174 wants to merge 2 commits into
microsoft:mainfrom
shreyanshjain7174:test/lcow-v2-feature-flag

Conversation

@shreyanshjain7174
Copy link
Copy Markdown
Contributor

What

Adds an opt-in -feature LCOWV2 gate across the functional and cri-containerd test suites so the in-progress v2 LCOW controller (internal/controller/vm + internal/builder/vm/lcow) can be exercised end-to-end without disturbing the existing v1 LCOW pipeline.

Why

The v2 controller landed across recent PRs (#2627, #2629, the VM SCSI/VPMem controllers, etc.) but lacked a dedicated functional surface. Existing LCOW tests are tightly coupled to v1 *uvm.OptionsLCOW and call testuvm.CreateLCOW / CreateAndStartLCOWFromOpts — they cannot drive the v2 controller without refactoring every test. A feature flag lets us:

  • run the v1 pipeline unchanged on every PR;
  • add v2 tests incrementally under TestLCOW_V2_*;
  • let CI exercise the v2 path on its own job (continue-on-error: true for now).

Changes

Functional suite (test/functional)

  • LCOWV2 implies LCOW in TestMain so featureLCOW-gated tests are reachable; then defaultLCOWOptions calls requireV1Only and every v1 path short-circuits cleanly. Net effect under -feature LCOWV2: only the new TestLCOW_V2_* tests actually run.
  • New helpers_v2_test.go and lcow_v2_test.go covering the v2 surface via internal/builder/vm/lcow + the v2 controller in-process.
  • Export LCOWBootFilesPath from test/pkg/uvm so v2 tests can resolve boot files without going through v1 *uvm.OptionsLCOW.

cri-containerd suite (test/cri-containerd)

  • Mirror the LCOWV2-implies-LCOW pattern in TestMain.
  • Thread RuntimeHandler onto the CRI ImageSpec when pulling LCOW images so containerd selects the windows-lcow snapshotter and linux/amd64 platform (the sandbox-platform label alone is not honored by containerd ≥ 2.0).
  • Add runhcs-lcow-v2 runtime handler constant and lcow_v2_test.go scaffold.

Flag plumbing (test/pkg/flag)

  • Add IncludesExplicit and Include on IncludeExcludeStringSet so test TestMain hooks can implement feature implications safely after flag.Parse without breaking default-when-unset semantics.

CI (.github/workflows/ci.yml)

  • New Build and run functional testing binary (LCOWV2) step that invokes functional.test.exe -feature=LCOWV2 -exclude=LCOWIntegrity. Marked continue-on-error: true while the v2 surface is being grown so a v2-specific failure does not block the v1 pipeline.
  • Build and upload containerd-shim-lcow-v2.exe as a test artifact.

Out of scope (follow-up)

  • CRI v2 testing (Test_V2_LCOW_* in test/cri-containerd) requires a CI step that starts containerd with snapshotter = "windows-lcow" set on both the runhcs-lcow AND runhcs-lcow-v2 runtime blocks. That step is deferred to a follow-up PR alongside the integration-tests v2 setup.
  • Growing the TestLCOW_V2_* surface beyond the initial scaffold.

Validation

  • Local: 10 v2 functional tests pass against the v2 controller via functional.test.exe -feature=LCOWV2 on a Windows host.
  • v1 pipeline: unchanged — existing -feature LCOW invocations route to the same code paths as before.
  • CRI v2 tests: do not pass locally against vanilla containerd because the upstream CRI plugin hardcodes platforms.DefaultSpec() in image_pull.go and ignores the runtime_platforms mapping; gating those tests on CI is intentionally deferred.

DCO

Signed-off-by in commit.

@shreyanshjain7174 shreyanshjain7174 requested a review from a team as a code owner May 20, 2026 15:48
Introduce a `-feature LCOWV2` gate across the functional and
cri-containerd test suites so the v2 LCOW controller can be exercised
end-to-end without disturbing the existing v1 LCOW pipeline.

Functional suite:
* LCOWV2 implies LCOW in TestMain so featureLCOW-gated tests are
  reachable, then defaultLCOWOptions calls requireV1Only to short-
  circuit every v1 path cleanly. Net effect: only TestLCOW_V2_* runs.
* Add helpers_v2_test.go and lcow_v2_test.go covering the v2 surface
  via internal/builder/vm/lcow + the v2 controller in-process.
* Export LCOWBootFilesPath from test/pkg/uvm so v2 tests can resolve
  boot files without going through v1 *uvm.OptionsLCOW.

cri-containerd suite:
* Mirror the LCOWV2-implies-LCOW pattern; thread RuntimeHandler onto
  the CRI ImageSpec when pulling LCOW images so containerd selects
  the windows-lcow snapshotter and linux/amd64 platform (the sandbox-
  platform label alone is not honored by containerd >=2.0).
* Add lcow_v2_test.go and the runhcs-lcow-v2 runtime handler constant.

Flag plumbing:
* Add IncludesExplicit and Include to IncludeExcludeStringSet so test
  TestMain hooks can implement feature implications safely after
  flag.Parse without breaking default-when-unset semantics.

CI:
* New `Build and run functional testing binary (LCOWV2)` step that
  invokes functional.test.exe -feature=LCOWV2. continue-on-error while
  the v2 surface is being grown. CRI v2 testing is intentionally
  deferred to a follow-up alongside the integration-tests v2 setup.
* Build and upload containerd-shim-lcow-v2.exe as a test artifact.

Signed-off-by: Shreyansh Sancheti <[email protected]>
v2.1.0 fails to typecheck cross-module imports from test/ that resolve
back into the parent module via a replace directive, producing:

  could not import github.com/Microsoft/hcsshim/internal/... (-: build
  constraints exclude all Go files in ...)

This only affects the (windows, test) lint matrix entry; the same
imports typecheck cleanly under (windows, "") and locally with v2.11.x.
v2.5+ resolves this.

Signed-off-by: Shreyansh Sancheti <[email protected]>
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.

3 participants