Skip to content

Conversation

o-l-a-v
Copy link
Contributor

@o-l-a-v o-l-a-v commented Sep 21, 2025

PR Summary

A little goof in an if statement in PSResourceInfo.cs made it so that PSResourceGet failed to get version range for dependencies where RequiredVersion was specified.

Fixes #1823

PR Context

PR Checklist

@o-l-a-v
Copy link
Contributor Author

o-l-a-v commented Sep 21, 2025

I added a test for this too.

It "Should find version range for Az dependencies" {
    # Target known version to know the output from the API won't change
    $res = Find-PSResource -Repository 'MAR' -Name 'Az' -Version '14.4.0'
    
    # Version defined by "ModuleVersion"
    $res.Dependencies.Where{$_.'Name' -eq 'Az.Accounts'}.'VersionRange'.ToString() | Should -Be '[5.3.0, )'
    
    # Version defined by "RequiredVersion"
    $res.Dependencies.Where{$_.'Name' -eq 'Az.Resources'}.'VersionRange'.ToString() | Should -Not -Be '[8.1.0, 8.1.0]'
}

@o-l-a-v o-l-a-v changed the title Fix 1823: MAR fails to parse RequiredVersion for dependencies Fix 1823 - MAR fails to parse RequiredVersion for dependencies Sep 21, 2025
Copy link
Member

@alerickson alerickson left a comment

Choose a reason for hiding this comment

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

Looks good over all, just a test failure with 'Should find version range for Az dependencies'

 Expected '[8.1.0, 8.1.0]' to be different from the actual value, but got the same value.
  321:         $res.Dependencies.Where{$_.'Name' -eq 'Az.Resources'}.'VersionRange'.ToString() | Should -Not -Be '[8.1.0, 8.1.0]'
  at <ScriptBlock>, D:\a\1\s\test\FindPSResourceTests\FindPSResourceContainerRegistryServer.Tests.ps1: line 321

@o-l-a-v
Copy link
Contributor Author

o-l-a-v commented Oct 1, 2025

Oops, I fixed the test goof now @alerickson. 😊

@alerickson alerickson enabled auto-merge (squash) October 2, 2025 20:30
@alerickson alerickson merged commit 7f619c0 into PowerShell:master Oct 2, 2025
6 checks passed
@o-l-a-v o-l-a-v deleted the fix-1823-mar-dependencies-version-range branch October 2, 2025 21:01
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.

MAR - (Find-PSResource -Repository 'MAR' -Name 'Az').'Dependencies' gives different result than PSGallery

2 participants