Repository navigation
[WSLC] Add live-host state-aware provision tests to the Rust and .NET SDKs - #1321
Closed
Soham Das (SohamDas2021) wants to merge 1 commit into
Closed
Soham Das (SohamDas2021) wants to merge 1 commit into
Soham Das (SohamDas2021) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Soham Das (SohamDas2021)
added this pull request to stack #1322
September 29, 2026 16:51
… SDKs Neither the Rust nor the .NET SDK had a test that provisioned a WSLC sandbox; their coverage stopped at request and envelope construction, so only the Node SDK exercised the real in-process path. Rust gets `src/core/mxc-sdk/tests/wslc_state_aware.rs` and .NET gets `MxcWslcLifecycleE2ETests` with a `WslcHost` gate modelled on the isolation-session suites. Both drive provision, start, exec, stop, and deprovision through their own binding, assert the minted id, the workload's stdout and exit code, a non-zero exit, and that a deprovisioned id is refused. Both deprovision on the unwind path so a failed assertion cannot leak a container, and both serialize: the .NET class joins the existing MxcLiveHost collection, and the Rust tests take a process-wide lock. A Rust test binary built with `--features wslc` could not see the WSLC backend at all. Cargo stages `wslcsdk.dll` and `wxc-wslc-daemon.exe` into `target/<profile>/`, but an integration test runs from `target/<profile>/deps/`, and both the DLL loader and the daemon lookup search beside the running binary. `available_backends()` therefore dropped `wslc`, a skip-if-unavailable gate would have skipped forever on a working host, and the suite would have reported green while testing nothing. The suite now copies both units beside its own binary before the first probe, comparing content rather than timestamps because every rebuild re-copies an identical DLL and re-staging one a live daemon has loaded fails. Skips are loud and `MXC_WSLC_TESTS_REQUIRED=1` turns them into failures, matching `MXC_ISO_TESTS_REQUIRED`. `MXC_WSLC_TEST_IMAGE` selects the image; the default `alpine:latest` is expected to be cached, since pulling is already covered by the WSLC executor E2E suite. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Soham Das (SohamDas2021)
force-pushed
the
sohamdas2021-sdk-wslc-provision-tests
branch
from
September 29, 2026 16:57
fa26d35 to
862df27
Compare
Copilot started reviewing on behalf of
Soham Das (SohamDas2021)
September 29, 2026 16:58
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The Rust staging helper can silently run against stale runtime artifacts from an earlier build.
Review effort: Balanced
Findings: 1
What changed in this PR
Adds live-host WSLC lifecycle coverage for the Rust and .NET SDK bindings.
Changes:
- Adds provision-to-deprovision WSLC integration tests.
- Stages Rust runtime units and supports mandatory host checks.
- Documents test prerequisites and environment variables.
| File | Description |
|---|---|
src/core/mxc-sdk/tests/wslc_state_aware.rs |
Adds Rust lifecycle tests and runtime staging. |
src/core/mxc-sdk/README.md |
Documents Rust WSLC test setup. |
sdk/dotnet/README.md |
Documents .NET WSLC host tests. |
sdk/dotnet/Microsoft.Mxc.Sdk.Tests/WslcHost.cs |
Adds the .NET host availability gate. |
sdk/dotnet/Microsoft.Mxc.Sdk.Tests/MxcWslcLifecycleE2ETests.cs |
Adds .NET lifecycle tests and cleanup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+41
to
+50
| if !source.exists() { | ||
| if staged.exists() { | ||
| continue; | ||
| } | ||
| return Err(format!( | ||
| "{unit} is beside neither this test binary nor {}; produce both units with \ | ||
| `cargo build -p wxc_wslc_daemon -p mxc-sdk --features mxc-sdk/wslc`", | ||
| profile_dir.display() | ||
| )); | ||
| } |
An error occurred while trying to automatically change base from
sohamdas2021-wslc-image-prepull
to
main
October 1, 2026 17:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Stacked on #1318 — base is
sohamdas2021-wslc-image-prepull, notmain. No file from that PR is touched.What was missing
Neither the Rust (
mxc-sdk) nor the .NET SDK had a test that provisioned a WSLC sandbox. Their WSLC coverage stopped at request and envelope construction, so only the Node SDK exercised the real in-process path. A binding could have broken end to end and every suite would still have been green.The staging problem this fixes
A Rust test binary built with
--features wslccould not see the WSLC backend at all.Cargo stages
wslcsdk.dllandwxc-wslc-daemon.exeintotarget/<profile>/, but an integration test runs fromtarget/<profile>/deps/, and both the DLL loader and the daemon lookup search beside the running binary. Soavailable_backends()reported:and after copying the two units into
deps/:Left alone, a skip-if-unavailable gate would have skipped forever on a host that runs WSLC perfectly well, and the suite would have reported green while testing nothing. The suite now copies both units beside its own binary before the first probe.
That copy compares content, not timestamps: every rebuild re-copies a byte-identical
wslcsdk.dllinto the profile directory with a fresh mtime, and re-staging a DLL a live daemon already has loaded fails with a sharing violation. An mtime check turned an ordinary rebuild-then-test cycle into five hard failures — caught while validating, and the reason the check reads bytes..NET does not have this problem:
Microsoft.Mxc.Sdk.csprojalready builds-p wxc_wslc_daemonunder-p:MxcWithWslc=trueand stages the whole native unit into the referencing test project's output.Covered
Both SDKs drive provision → start → exec → stop → deprovision through their own binding:
wslc:prefix, and the later phases accept it)not_provisionedavailable_backends()reportswslcto a test binary — the named regression test for the staging fixEvery provisioned sandbox is deprovisioned on the unwind path, so a mid-test assertion failure cannot leak a container. Runs are serialized: the .NET class joins the existing
MxcLiveHostcollection, so it never runs alongside the isolation-session suite either, and the Rust tests take a process-wide lock. Neither touchesC:\mxc_wslc_cold_cache_test; they use the default image store.Skips are loud and convertible:
MXC_WSLC_TESTS_REQUIRED=1turns every skip into a failure, mirroringMXC_ISO_TESTS_REQUIRED.MXC_WSLC_TEST_IMAGEselects the image.Not covered
timedOut, andAbortSignal; this layer proves binding reachability rather than re-testing daemon semantics.WslcListSessionImageswithERROR_SHARING_VIOLATION. That is pre-existing and deliberately avoided here, not fixed.Validation
All run on a live WSLC host; nothing skipped.
The Rust suite was also re-run with
target/debug/deps/emptied of both units, to prove the staging helper restores them from cold: 5 passed.Microsoft Reviewers: Open in CodeFlow