Repository navigation
Migrate test package feeds to dotnet-public - #55463
Conversation
|
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. |
There was a problem hiding this comment.
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.jsonacross multiple test suites and a dotnet-format test asset. - Updated approval
.verified.txtsnapshots that include the feed URL in output. - Rewrote
GetLatestVersion()inDotnetNewDetailsTest.Approval.csto resolvePackageBaseAddressfrom 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. |
|
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. |
JoeRobich
left a comment
There was a problem hiding this comment.
dotnet-format change looks good.
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
f81b093 to
fdb4fce
Compare
|
/ba-g known watch mac arm64 failure |
Co-authored-by: Copilot App <[email protected]> (cherry picked from commit a7a9e91)
Motivation
Reduce direct package downloads from
nuget.orgin CI and PR validation by using the Azure DevOpsdotnet-publicfeed for tests that require publicly available NuGet packages.Changes
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.jsondotnet-publicwith available Microsoft-owned equivalents, includingMicrosoft.Android.Templates,Microsoft.DotNet.Web.ProjectTemplates.10.0, andMicrosoft.Azure.WebJobs.ProjectTemplates.Microsoft.DotNet.Common.ProjectTemplates.5.0where the test intentionally validates fixed-version installation and latest-version discovery behavior.dotnet-publicsearch endpoint and isolated relevant tests from inherited package sources.Intentional exception
The two vulnerability-handling tests still use
https://api.nuget.org/v3/index.jsonbecause the current template-engine implementation reads vulnerability metadata from package metadata and does not consume NuGet<auditSources>. Changing them todata.nuget.orgwould 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.