Skip to content

Fix flakey MockServer test - #7296

Merged
zivkan merged 1 commit into
devfrom
dev-zivkan-fix-flakey-mockserver-test
Apr 18, 2026
Merged

zivkan merged 1 commit into
devfrom
dev-zivkan-fix-flakey-mockserver-test

Conversation

@zivkan

@zivkan zivkan commented Apr 17, 2026

Copy link
Copy Markdown
Member

Bug

Fixes: flakey test

Description

The MockServer used by the test NuGetMockServerTests.MockServer_VerifySessionId sets up the MockServer with two packages, but the MockServer would not filter V2 OData results based on the incoming request and would therefore return info about both packages when asked for just one.

Copilot says the flakiness is related to the cache in FindPackagesByIdNupkgDownloader. Since the two packages are downloaded in parllel, it just depends on thread timing which one gets added to the cache first, and that determines if the test will pass or fail. The failure was caused by the mock server returning the wrong nupkg to restore, and the recently added package id validation on download is failing the test which previously did not fail.

Running the test 10 times locally it previously failed 5 times and now passes all 10 times.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@zivkan
zivkan requested a review from a team as a code owner April 17, 2026 07:31
@zivkan
zivkan requested review from jeffkl and nkolev92 April 17, 2026 07:31
@zivkan
zivkan merged commit de3b92c into dev Apr 18, 2026
17 of 18 checks passed
@zivkan
zivkan deleted the dev-zivkan-fix-flakey-mockserver-test branch April 18, 2026 03:26
zivkan added a commit that referenced this pull request Sep 2, 2026
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.

4 participants