Repository navigation
Fix V3 packageContent URL selection to compare parsed versions #2019
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
Open
Eugene Tolmachev (et1975)
wants to merge
7
commits into
PowerShell:master
Choose a base branch
from
et1975:copilot/check-claims-and-create-failing-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+268
−141
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
66aecec
Fix V3 packageContent URL selection to compare parsed versions (issue…
Copilot 4da50cd
Address PR #2019 review feedback on V3 packageContent URL selection
Copilot c90cd6e
Fix V3 package URL filename matching
et1975 eef282e
Select the V3 package to install by its catalogEntry version instead …
alerickson 69d75a4
Merge branch 'master' into checkClaims
alerickson 09d292d
Add missing ConvertFromJson method in test hook
alerickson 38070f7
Include the prerelease label in the version passed to InstallPackageA…
alerickson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
test/InstallPSResourceTests/InstallPSResourceV3ServerVersionSelection.Tests.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| Import-Module "$psscriptroot/../PSGetTestUtils.psm1" -Force | ||
|
|
||
| Describe 'Test V3 packageContent url selection for a required version' -tags 'CI' { | ||
|
|
||
| BeforeAll { | ||
| $packageBaseAddress = 'https://api.nuget.org/v3-flatcontainer/test_module' | ||
| # Responses are returned in descending version order, ie the entry for 1.2.30 precedes the entry for 1.2.3 | ||
| $versionedResponses = @( | ||
| "$packageBaseAddress/1.2.30/test_module.1.2.30.nupkg", | ||
| "$packageBaseAddress/1.2.3/test_module.1.2.3.nupkg" | ||
| ) | ||
| } | ||
|
|
||
| It 'Should select the url for the exact version requested' { | ||
| $url = [Microsoft.PowerShell.PSResourceGet.UtilClasses.TestHooks]::SelectV3PackageContentUrl($versionedResponses, '1.2.3') | ||
| $url | Should -BeExactly "$packageBaseAddress/1.2.3/test_module.1.2.3.nupkg" | ||
| } | ||
|
|
||
| It 'Should not select the url of a version which the requested version is a prefix of' { | ||
|
et1975 marked this conversation as resolved.
Outdated
|
||
| $url = [Microsoft.PowerShell.PSResourceGet.UtilClasses.TestHooks]::SelectV3PackageContentUrl($versionedResponses, '1.2.30') | ||
| $url | Should -BeExactly "$packageBaseAddress/1.2.30/test_module.1.2.30.nupkg" | ||
| } | ||
|
|
||
| It 'Should select the url for a version with four version parts' { | ||
| $responses = @( | ||
| "$packageBaseAddress/2024.5.20.12/test_module.2024.5.20.12.nupkg", | ||
| "$packageBaseAddress/2024.5.20.1/test_module.2024.5.20.1.nupkg" | ||
| ) | ||
| $url = [Microsoft.PowerShell.PSResourceGet.UtilClasses.TestHooks]::SelectV3PackageContentUrl($responses, '2024.5.20.1') | ||
| $url | Should -BeExactly "$packageBaseAddress/2024.5.20.1/test_module.2024.5.20.1.nupkg" | ||
| } | ||
|
|
||
| It 'Should select the url for a prerelease version' { | ||
| $responses = @( | ||
| "$packageBaseAddress/2.5.0-beta10/test_module.2.5.0-beta10.nupkg", | ||
| "$packageBaseAddress/2.5.0-beta1/test_module.2.5.0-beta1.nupkg" | ||
| ) | ||
| $url = [Microsoft.PowerShell.PSResourceGet.UtilClasses.TestHooks]::SelectV3PackageContentUrl($responses, '2.5.0-beta1') | ||
| $url | Should -BeExactly "$packageBaseAddress/2.5.0-beta1/test_module.2.5.0-beta1.nupkg" | ||
| } | ||
|
|
||
| It 'Should select the url when the version is passed as a query parameter' { | ||
| $responses = @( | ||
| "https://www.myget.org/api/download?packageId=test_module&packageVersion=1.2.30", | ||
| "https://www.myget.org/api/download?packageId=test_module&packageVersion=1.2.3" | ||
| ) | ||
| $url = [Microsoft.PowerShell.PSResourceGet.UtilClasses.TestHooks]::SelectV3PackageContentUrl($responses, '1.2.3') | ||
| $url | Should -BeExactly "https://www.myget.org/api/download?packageId=test_module&packageVersion=1.2.3" | ||
| } | ||
|
|
||
| It 'Should not select any url when the requested version is not present' { | ||
| $url = [Microsoft.PowerShell.PSResourceGet.UtilClasses.TestHooks]::SelectV3PackageContentUrl($versionedResponses, '1.2.4') | ||
| $url | Should -BeNullOrEmpty | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.