Skip to content

Share third-party packages between test runs through a fallback folder - #18

Merged
vfofanov merged 5 commits into
mainfrom
feat/test-nuget-shared-fallback
Oct 6, 2026
Merged

vfofanov merged 5 commits into
mainfrom
feat/test-nuget-shared-fallback

Conversation

@vfofanov

@vfofanov vfofanov commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Test runs share third-party NuGet packages through a folder the tests own, instead of reading the machine's global-packages folder. Follow-up to #15.

  • Per-run folders: NUGET_PACKAGES and NUGET_HTTP_CACHE_PATH under dist/nuget-runs/<script>.<pid>.<time>/, removed by a trap that also runs on HUP/INT/TERM; the next run sweeps what a killed run left (marker file + dead pid only).
  • Shared fallback: dist/nuget-shared (MSBUILDKIT_TESTS_NUGET_SHARED_DIR overrides) is the run's NUGET_FALLBACK_PACKAGES. At the end of a run, packages downloaded from an https feed move into it, staged and published with one rename. Loopback, plain http, local-folder sources and kit packages (MSBUILDKIT_TESTS_KIT_PACKAGE_PREFIXES, default DragoAnt.MSBuildKit;DragoAnt.Fixture.;DragoAnt.Samples.) never do.
  • Machine folder: refused as the shared folder (normalised path compare); its kit-package listing is hashed before and after the run and compared with what the run packed. The red case uses a stand-in folder.
  • Accessor: ni_packages_dir; a test file that names a packages folder itself fails the run.
  • tests/nuget-isolation.test.sh: 23 unit checks on hand-made folders (no dotnet, no network), run from tests/run.sh.
  • Docs: CONTRIBUTING "NuGet packages during a run", CHANGELOG.

The kit ships no code that enumerates the package cache, so nothing needed fallback-folder support there.

Evidence
  • Red first: the unit checks failed before the implementation (commit 1). With the https rule switched off, the harvest check fails (local.posix, local.windows, plain.http taken).
  • sh tests/manager.sh on a loaded Windows machine: cold shared folder 474 s (48 packages moved), warm 151 s (0 moved).

Shared fallback folder, https-only harvest, kit prefixes, parallel
harvest, leftover sweep, run lifecycle, machine-folder refusal, the
hard-coded-folder check and the machine-folder guard.
Each run gets its own packages folder and HTTP cache under
dist/nuget-runs, removed by a trap that also runs on HUP, INT and
TERM; the next run sweeps what a killed one left, by marker file.
Packages a run downloaded from an https feed move into the shared
folder (MSBUILDKIT_TESTS_NUGET_SHARED_DIR, default dist/nuget-shared)
with one rename each; kit packages never do. The machine's folder is
refused as the shared folder and compared before and after by hash.
An earlier edit of tests/run.sh turned the literal carriage return
inside tr -d into a line feed, so the check failed on Windows.
@vfofanov
vfofanov marked this pull request as ready for review October 6, 2026 19:46
@vfofanov
vfofanov merged commit e1f344a into main Oct 6, 2026
4 checks passed
@vfofanov
vfofanov deleted the feat/test-nuget-shared-fallback branch October 6, 2026 19:47
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.

1 participant