Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the tests go through the no-op restore codepath #3747

Merged
merged 4 commits into from
Nov 11, 2020

Conversation

nkolev92
Copy link
Member

@nkolev92 nkolev92 commented Oct 30, 2020

Bug

Fixes: NuGet/Home#10211
Regression: No

  • Last working version:
  • How are we preventing it in future:

Fix

Details:

While I investigating NuGet/Home#10068, I hit an known problem of the no-op codepath not being exercised in a good amount of unit test.

The reason is that the packagespec is not created with the same amount of details prod package spec would be.
In prod scenarios, all restores go through the restorerunner which calls

public static void ValidateDependencySpec(DependencyGraphSpec spec, HashSet<string> projectsToSkip)
to validate that things like the RestoreMedata are not null or empty.

Now this is not a major problem for no-op, I have not discovered any regressions because of this, but it does not reflect what the actual restore code run is.

Now the TestRestoreRequest is written in a way that'd prevent restore going through unexpected codepaths.

Note that I am aware that these tests are running project.json.
Changing them to PR is not super straightforward and can be done as a future step. NuGet/Home#10212

Testing/Validation

Tests Added: No
Reason for not adding tests: I am changing all the tests :)
Validation:

@nkolev92 nkolev92 marked this pull request as ready for review October 30, 2020 19:30
@nkolev92 nkolev92 requested a review from a team as a code owner October 30, 2020 19:30
@nkolev92
Copy link
Member Author

nkolev92 commented Nov 9, 2020

@NuGet/nuget-client 🔔
Review please. It's been ~10 days.

Copy link
Member

@zivkan zivkan left a comment

Choose a reason for hiding this comment

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

GitHub has all the files marked as viewed, meaning I already reviewed this, who knows how long ago, but forgot to submit a review 😞

@nkolev92 nkolev92 merged commit 5fa6e6b into dev Nov 11, 2020
@nkolev92 nkolev92 deleted the dev-nkolev92-makeTestsGoThroughNoOpPath branch November 11, 2020 00:41

private static PackageSpec WithProjectJsonTestRestoreMetadata(this PackageSpec spec)
{
var updated = spec.Clone();
Copy link
Contributor

@kartheekp-ms kartheekp-ms Nov 11, 2020

Choose a reason for hiding this comment

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

Can we skip cloning here? If am trying to understand why we need to clone here.

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.

Add metadata to restore tests, make them go through the no-op codepath
4 participants