Skip to content

Migrate test package feeds to dotnet-public - #55463

Merged
marcpopMSFT merged 19 commits into
mainfrom
marcpopmsft-nuget-org-test-dependency-audit
Aug 12, 2026
Merged

marcpopMSFT merged 19 commits into
mainfrom
marcpopmsft-nuget-org-test-dependency-audit

Conversation

@marcpopMSFT

@marcpopMSFT marcpopMSFT commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Motivation

Reduce direct package downloads from nuget.org in CI and PR validation by using the Azure DevOps dotnet-public feed for tests that require publicly available NuGet packages.

Changes

  • Updated template package installation, discovery, metadata, and details tests to use:
    https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json
  • Updated the shared template test package manager and the dotnet-format analyzer test asset.
  • Replaced packages unavailable from dotnet-public with available Microsoft-owned equivalents, including Microsoft.Android.Templates, Microsoft.DotNet.Web.ProjectTemplates.10.0, and Microsoft.Azure.WebJobs.ProjectTemplates.
  • Retained Microsoft.DotNet.Common.ProjectTemplates.5.0 where the test intentionally validates fixed-version installation and latest-version discovery behavior.
  • Updated approval baselines and stabilized dynamic package versions, feed URLs, and template inventory output.
  • Updated the template discovery test for the dotnet-public search endpoint and isolated relevant tests from inherited package sources.

Intentional exception

The two vulnerability-handling tests still use https://api.nuget.org/v3/index.json because the current template-engine implementation reads vulnerability metadata from package metadata and does not consume NuGet <auditSources>. Changing them to data.nuget.org would require a production implementation change rather than a test-only feed swap.

Validation coverage

The affected tests continue to cover package installation, fixed and latest-version behavior, package metadata, template discovery, template details, vulnerability rejection, and forced installation.

Copilot AI review requested due to automatic review settings July 24, 2026 20:01
@marcpopMSFT
marcpopMSFT requested review from a team as code owners July 24, 2026 20:01
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

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.

Pull request overview

This PR reduces CI/test reliance on https://api.nuget.org by switching test-only NuGet feed usage to the packagefeedproxy.microsoft.io V3 endpoint, and updates affected approval snapshots accordingly. It also refactors one test helper to derive the package base address from the feed’s V3 service index instead of hardcoding the nuget.org flat-container URL.

Changes:

  • Replaced nuget.org V3 feed URLs with https://packagefeedproxy.microsoft.io/nuget/v3/index.json across multiple test suites and a dotnet-format test asset.
  • Updated approval .verified.txt snapshots that include the feed URL in output.
  • Rewrote GetLatestVersion() in DotnetNewDetailsTest.Approval.cs to resolve PackageBaseAddress from the V3 service index.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/TestAssets/dotnet-format/for_analyzer_formatter/analyzer_project/NuGet.config Points the test asset restore source at packagefeedproxy instead of api.nuget.org.
test/TemplateEngine/Microsoft.TemplateSearch.TemplateDiscovery.IntegrationTests/NuGetTests.cs Uses packagefeedproxy V3 service index for TemplateDiscovery integration test.
test/TemplateEngine/Microsoft.TemplateEngine.TestHelper/PackageManager.cs Updates central NuGet feed constant used by template tests to packagefeedproxy.
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/TemplatePackagesTests.cs Switches install source URL and expected NuGetSource detail to packagefeedproxy.
test/TemplateEngine/Microsoft.TemplateEngine.Edge.UnitTests/NuGetApiPackageManagerTests.cs Updates additional source list to packagefeedproxy.
test/dotnet-new.IntegrationTests/DotnetNewInstallTests.cs Updates --nuget-source / --add-source arguments to packagefeedproxy.
test/dotnet-new.IntegrationTests/DotnetNewDetailsTest.Approval.cs Updates inline NuGet.Config feed URL and refactors latest-version lookup to use service index.
test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_RemotePackage_NuGetFeedNoVersion.verified.txt Snapshot updated for new feed URL.
test/dotnet-new.IntegrationTests/Approvals/DotnetNewDetailsTest.CanDisplayDetails_InstalledPackage_NuGetFeed.verified.txt Snapshot updated for new feed URL.

@marcpopMSFT

Copy link
Copy Markdown
Member Author

We need an internal test run first before merging this and we'll need this in all branches. The internal pipelines are having issues at the moment that look like infra. Will need to ping FR.

@marcpopMSFT
marcpopMSFT requested a review from a team as a code owner July 27, 2026 23:20

@JoeRobich JoeRobich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

dotnet-format change looks good.

marcpopMSFT and others added 19 commits August 7, 2026 10:06
Swap api.nuget.org/v3/index.json to packagefeedproxy.microsoft.io
in template engine, dotnet-new integration, and dotnet-format test
infrastructure to reduce direct nuget.org dependency in CI/PR pipelines.

Tests that use non-standard NuGet endpoints (flat-container, direct
search API) are left unchanged as they require code rewrites.

Co-authored-by: Copilot <[email protected]>
Instead of hardcoding the api.nuget.org/v3-flatcontainer URL, resolve
the PackageBaseAddress endpoint from the proxy's V3 service index.
This follows the NuGet V3 protocol properly and works with the
packagefeedproxy.microsoft.io feed.

Co-authored-by: Copilot <[email protected]>
The NuGet V3 service index spec allows @type to be either a string or
an array of strings. Update GetLatestVersion() to handle both cases
and throw a clear exception if PackageBaseAddress is not found.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
- Category A: Remove assertions on Reserved/Owners fields not returned
  by the proxy feed; update .verified.txt baselines accordingly
- Category B: Add data.nuget.org as second source for vulnerability
  tests so VulnerabilityInfo metadata is available
- Category C: Accept any non-empty NuGetSource URL (proxy may normalize
  back to api.nuget.org internally)
- Category D: Pass --nuget-source to OtherFeed detail tests so version
  resolution uses the same feed as GetLatestVersion()
- Category E: Relax CanReadPackageInfo assertions for TotalHits,
  Reserved, Owners, and IconUrl that differ on the proxy

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
Remove extra leading whitespace on _vulnerabilitySources field declaration
that triggered IDE0055 (Fix formatting) as error-on-CI.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
…s quirk, separate vulnerability source

- Rewrite GetLatestVersion() to use SearchQueryService instead of
  PackageBaseAddress/flat-container to match dotnet-new behavior
- Fix CanReadPackageInfo: proxy returns TotalHits=0 but Data has entries,
  assert on Data emptiness instead
- Use api.nuget.org for vulnerability metadata tests (proxy lacks it in
  registration blobs)
- Add scrubbers for NuGetFeedNoVersion baseline: version placeholder and
  template list truncation for cross-feed compatibility

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
- CanReadPackageInfo: Add fallback to versioned type SearchQueryService/3.0.0-beta
  when base type prefix matching returns no entries from proxy service index
- NuGetFeedNoVersion: Remove Templates section from baseline since proxy feed
  does not include template listing in package details output
- NuGetApiPackageManagerTests: Switch vulnerability sources from api.nuget.org
  to data.nuget.org/v3/index.json (preferred read-only audit data source)

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
- Switch _vulnerabilitySources from data.nuget.org to proxy feed
  (data.nuget.org is not a full V3 feed and lacks RegistrationsBaseUrl,
  causing NullReferenceException in GetPackageMetadataAsync)
- Relax TotalDownloads assertion since proxy returns 0 for some packages

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
MSTest Assert does not have IsGreaterThanOrEqual. Use FluentAssertions
BeGreaterThanOrEqualTo which is already imported in this test file.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
The proxy does not include vulnerability data in its registration blobs,
so the HasVulnerabilities tests must use api.nuget.org (read-only metadata).
All other tests continue using the proxy for package download and search.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
Replace packagefeedproxy.microsoft.io URLs with the dotnet-public ADO
feed (pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json)
across all affected test files.

Package replacements (not available in dotnet-public):
- Uno.ProjectTemplates.Dotnet -> Microsoft.Android.Templates
- Take.Blip.Client.Templates -> Microsoft.Android.Templates
- Boxed.Templates -> Microsoft.DotNet.Web.ProjectTemplates.10.0
- Sln -> Microsoft.DotNet.Common.ProjectTemplates.5.0
- Functions.Worker.ProjectTemplates -> Microsoft.Azure.WebJobs.ProjectTemplates

Other changes:
- Use api.nuget.org for vulnerability data source (read-only audit data)
- Relax metadata assertions (Owners/Reserved) for dotnet-public behavior
- Remove proxy-specific SearchQueryService fallback in NuGetTests
- Update approval baselines for Android Templates package

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
The dotnet-public feed exposes SearchQueryService as
SearchQueryService/3.0.0-beta, so the existing exact lookup for
SearchQueryService returned no entries and failed on all legs.

Add a fallback lookup for SearchQueryService/3.0.0-beta before asserting.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
… and update verified file

The 'must fail' assertion used --nuget-source <emptyFolder> which is additive
in NuGet; CI environments that have a globally-configured dotnet11 feed still
resolve the package and return exit code 0, causing the assertion to flip.

Fix: write a NuGet.Config with <clear /> to the working directory before the
failure-case call.  This strips all globally-configured sources so the command
genuinely has nowhere to find the package.  The success-case call explicitly
passes --nuget-source to the dotnet-public ADO feed, which works regardless of
the working-directory NuGet.Config.

Also:
- Add the license-URL version scrubber (microsoft.android.templates/<VER>/)
  so the verified snapshot stays stable across package releases.
- Update the verified file to match the current real output from the
  dotnet-public feed: non-empty Details, plain URL source, License Url /
  Repository Url fields, and scrubbed template table.
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d86dfdd8-d040-4ddf-b190-19f27d044c4c
@marcpopMSFT
marcpopMSFT force-pushed the marcpopmsft-nuget-org-test-dependency-audit branch from f81b093 to fdb4fce Compare August 7, 2026 17:06
@marcpopMSFT marcpopMSFT changed the title Replace nuget.org feed URLs with packagefeedproxy in tests Migrate test package feeds to dotnet-public Aug 10, 2026
@marcpopMSFT

Copy link
Copy Markdown
Member Author

/ba-g known watch mac arm64 failure

@marcpopMSFT
marcpopMSFT merged commit a7a9e91 into main Aug 12, 2026
20 of 22 checks passed
@marcpopMSFT
marcpopMSFT deleted the marcpopmsft-nuget-org-test-dependency-audit branch August 12, 2026 20:35
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Aug 15, 2026
marcpopMSFT added a commit that referenced this pull request Nov 19, 2026
Co-authored-by: Copilot App <[email protected]>

(cherry picked from commit a7a9e91)
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.

5 participants