@@ -6,7 +6,7 @@ Import-Module $modPath -Force -Verbose
66
77Describe ' Test HTTP Find-PSResource for ACR Server Protocol' - tags ' CI' {
88
9- BeforeAll{
9+ BeforeAll {
1010 $testModuleName = " test-module"
1111 $testModuleWith2DigitVersion = " test-2DigitPkg"
1212 $testModuleParentName = " test_parent_mod"
@@ -19,13 +19,11 @@ Describe 'Test HTTP Find-PSResource for ACR Server Protocol' -tags 'CI' {
1919
2020 $usingAzAuth = $env: USINGAZAUTH -eq ' true'
2121
22- if ($usingAzAuth )
23- {
22+ if ($usingAzAuth ) {
2423 Write-Verbose - Verbose " Using Az module for authentication"
2524 Register-PSResourceRepository - Name $ACRRepoName - ApiVersion ' ContainerRegistry' - Uri $ACRRepoUri - Verbose
2625 }
27- else
28- {
26+ else {
2927 $psCredInfo = New-Object Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCredentialInfo (" SecretStore" , " $env: TENANTID " )
3028 Register-PSResourceRepository - Name $ACRRepoName - ApiVersion ' ContainerRegistry' - Uri $ACRRepoUri - CredentialInfo $psCredInfo - Verbose
3129 }
@@ -51,18 +49,18 @@ Describe 'Test HTTP Find-PSResource for ACR Server Protocol' -tags 'CI' {
5149 $res | Should - BeNullOrEmpty
5250 }
5351
54- $testCases2 = @ {Version = " [5.0.0.0]" ; ExpectedVersions = @ (" 5.0.0" ); Reason = " validate version, exact match" },
55- @ {Version = " 5.0.0.0" ; ExpectedVersions = @ (" 5.0.0" ); Reason = " validate version, exact match without bracket syntax" },
56- @ {Version = " [1.0.0.0, 5.0.0.0]" ; ExpectedVersions = @ (" 1.0.0" , " 3.0.0" , " 5.0.0" ); Reason = " validate version, exact range inclusive" },
57- @ {Version = " (1.0.0.0, 5.0.0.0)" ; ExpectedVersions = @ (" 3.0.0" ); Reason = " validate version, exact range exclusive" },
58- @ {Version = " (1.0.0.0,)" ; ExpectedVersions = @ (" 3.0.0" , " 5.0.0" ); Reason = " validate version, minimum version exclusive" },
59- @ {Version = " [1.0.0.0,)" ; ExpectedVersions = @ (" 1.0.0" , " 3.0.0" , " 5.0.0" ); Reason = " validate version, minimum version inclusive" },
60- @ {Version = " (,3.0.0.0)" ; ExpectedVersions = @ (" 1.0.0" ); Reason = " validate version, maximum version exclusive" },
61- @ {Version = " (,3.0.0.0]" ; ExpectedVersions = @ (" 1.0.0" , " 3.0.0" ); Reason = " validate version, maximum version inclusive" },
62- @ {Version = " [1.0.0.0, 5.0.0.0)" ; ExpectedVersions = @ (" 1.0.0" , " 3.0.0" ); Reason = " validate version, mixed inclusive minimum and exclusive maximum version" }
63- @ {Version = " (1.0.0.0, 5.0.0.0]" ; ExpectedVersions = @ (" 3.0.0" , " 5.0.0" ); Reason = " validate version, mixed exclusive minimum and inclusive maximum version" }
52+ $testCases2 = @ {Version = " [5.0.0.0]" ; ExpectedVersions = @ (" 5.0.0" ); Reason = " validate version, exact match" },
53+ @ {Version = " 5.0.0.0" ; ExpectedVersions = @ (" 5.0.0" ); Reason = " validate version, exact match without bracket syntax" },
54+ @ {Version = " [1.0.0.0, 5.0.0.0]" ; ExpectedVersions = @ (" 1.0.0" , " 3.0.0" , " 5.0.0" ); Reason = " validate version, exact range inclusive" },
55+ @ {Version = " (1.0.0.0, 5.0.0.0)" ; ExpectedVersions = @ (" 3.0.0" ); Reason = " validate version, exact range exclusive" },
56+ @ {Version = " (1.0.0.0,)" ; ExpectedVersions = @ (" 3.0.0" , " 5.0.0" ); Reason = " validate version, minimum version exclusive" },
57+ @ {Version = " [1.0.0.0,)" ; ExpectedVersions = @ (" 1.0.0" , " 3.0.0" , " 5.0.0" ); Reason = " validate version, minimum version inclusive" },
58+ @ {Version = " (,3.0.0.0)" ; ExpectedVersions = @ (" 1.0.0" ); Reason = " validate version, maximum version exclusive" },
59+ @ {Version = " (,3.0.0.0]" ; ExpectedVersions = @ (" 1.0.0" , " 3.0.0" ); Reason = " validate version, maximum version inclusive" },
60+ @ {Version = " [1.0.0.0, 5.0.0.0)" ; ExpectedVersions = @ (" 1.0.0" , " 3.0.0" ); Reason = " validate version, mixed inclusive minimum and exclusive maximum version" }
61+ @ {Version = " (1.0.0.0, 5.0.0.0]" ; ExpectedVersions = @ (" 3.0.0" , " 5.0.0" ); Reason = " validate version, mixed exclusive minimum and inclusive maximum version" }
6462
65- It " Find resource when given Name to <Reason> <Version>" - TestCases $testCases2 {
63+ It " Find resource when given Name to <Reason> <Version>" - TestCases $testCases2 {
6664 # FindVersionGlobbing()
6765 param ($Version , $ExpectedVersions )
6866 $res = Find-PSResource - Name $testModuleName - Version $Version - Repository $ACRRepoName
@@ -311,12 +309,23 @@ Describe 'Test Find-PSResource for MAR Repository' -tags 'CI' {
311309 $res | Should -Not - BeNullOrEmpty
312310 $res.Count | Should - BeGreaterThan 1
313311 }
312+
313+ It " Should find version range for Az dependencies" {
314+ # Target known version to know the output from the API won't change
315+ $res = Find-PSResource - Repository ' MAR' - Name ' Az' - Version ' 14.4.0'
316+
317+ # Version defined by "ModuleVersion"
318+ $res.Dependencies.Where {$_ .' Name' -eq ' Az.Accounts' }.' VersionRange' .ToString() | Should -Not - Be ' (, )'
319+
320+ # Version defined by "RequiredVersion"
321+ $res.Dependencies.Where {$_ .' Name' -eq ' Az.Resources' }.' VersionRange' .ToString() | Should -Not - Be ' (, )'
322+ }
314323}
315324
316325# Skip this test fo
317326Describe ' Test Find-PSResource for unauthenticated ACR repository' - tags ' CI' {
318327 BeforeAll {
319- $skipOnWinPS = $PSVersionTable.PSVersion.Major -eq 5
328+ $skipOnWinPS = $PSVersionTable.PSVersion.Major -eq 5
320329
321330 if (-not $skipOnWinPS ) {
322331 Register-PSResourceRepository - Name " Unauthenticated" - Uri " https://psresourcegetnoauth.azurecr.io/" - ApiVersion " ContainerRegistry"
0 commit comments