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

(#1174)(#1610) Add tests for package versions with leading zeros #2970

Merged
merged 5 commits into from
Jan 16, 2023

Conversation

TheCakeIsNaOH
Copy link
Member

@TheCakeIsNaOH TheCakeIsNaOH commented Jan 12, 2023

Description Of Changes

This adds pack tests to ensure that leading zeros are removed, and that a zero in the fourth part of the version will be trimmed down to three parts.

More scenarios are added to ensure that pre-existing packages with non-normalized versions can be installed/upgrade/uninstalled, and that they can be found when searching with a version.

Motivation and Context

As a part of supporting SemVer v2, some version normalization was added.
https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#normalized-version-numbers

The pack tests are to ensure that the version normalization on pack with the new NuGet assemblies is consistent into the future. There were already pack tests for removing semver v2 build metadata and that four part versions still work.

The other tests make sure that pre-existing non-normalized versions of packages still install/upgrade/uninstall correctly, and that when specifying a version they can be found.

Testing

  • Ran added tests

Operating Systems Testing

  • Windows 10 22H2

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked?

Related Issue

Tests for #1174
Part of #1610
https://app.clickup.com/t/20540031/PROJ-381

@TheCakeIsNaOH TheCakeIsNaOH force-pushed the version-normalization-tests branch 7 times, most recently from c667c97 to 9cb40e9 Compare January 13, 2023 22:42
@TheCakeIsNaOH TheCakeIsNaOH marked this pull request as ready for review January 13, 2023 22:42
… zeros

These tests are to ensure that the version normalization on pack with the
new NuGet assemblies is consistent into the future. There were already tests
for removing semver v2 build metadata and that four part versions still work.
This adds tests to ensure that leading zeros are removed, and that a zero in
the fourth part of the version will be trimmed down to three parts.
https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#normalized-version-numbers
Previously, when running some of the pack scenarios in Visual Studio,
some of the resulting packages contained the entire contents of the debug
folder, which slowed the the test as it took longer to pack.
This add a dependency and empty files element, so only the nuspec is packed.
…s with leading zeros

Also adds install tests for packages with a forth part zero
When specifying a version for list/search, the check should be comparing
the search metadata version with a nugetversion, not with a string comparision
This fixes that, and moves it inside the nugetlist class so as to ensure
that the check happens even when running list from the class
directly.
@gep13 gep13 force-pushed the version-normalization-tests branch from 9cb40e9 to de451cd Compare January 16, 2023 09:15
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

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

LGTM!

@gep13 gep13 merged commit b86f484 into chocolatey:develop Jan 16, 2023
@gep13
Copy link
Member

gep13 commented Jan 16, 2023

@TheCakeIsNaOH thanks for getting these added!

@TheCakeIsNaOH TheCakeIsNaOH deleted the version-normalization-tests branch January 16, 2023 22:55
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.

2 participants