Skip to content

Commit a7d2bcc

Browse files
Align version tests with PSResourceGet lowest-in-range resolution
1 parent f0cf99d commit a7d2bcc

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

.github/workflows/TestWorkflow.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ jobs:
120120
ShowRateLimit: true
121121
Script: |
122122
$loaded = (Get-Module -Name GitHub).Version
123-
if ($loaded -ne [version]'0.39.0') {
124-
throw "Expected '[0.38.0, 0.40.0)' to resolve to 0.39.0, but found '$loaded'."
123+
if ($loaded -lt [version]'0.38.0' -or $loaded -ge [version]'0.40.0') {
124+
throw "Expected '[0.38.0, 0.40.0)' to resolve within [0.38.0, 0.40.0), but found '$loaded'."
125125
}
126126
Write-Host "OK: bounded range resolved to $loaded"
127127
@@ -165,27 +165,26 @@ jobs:
165165
shell: pwsh
166166
run: |
167167
Install-PSResource -Name GitHub -Version '0.40.0' -Repository PSGallery -TrustRepository -Reinstall
168-
# When an installed version already satisfies the requested range, the action must reuse it
169-
# and must not install another copy. The exact-string already-installed check never matches a
170-
# range, so it reinstalls the latest (leaving two installed versions); the range-aware check
171-
# keeps exactly one.
168+
# 0.40.0 already satisfies the requested range, so the action must REUSE it and must not
169+
# install another copy. The exact-string already-installed check never matches a range, so it
170+
# reinstalls the range floor (0.38.0) side-by-side, leaving two installed versions; the
171+
# range-aware check keeps exactly one.
172172
- name: Action-Test [already-installed range]
173173
uses: ./
174174
with:
175-
Version: '[0.40.0, ]'
175+
Version: '[0.38.0, ]'
176176
Prerelease: ${{ inputs.Prerelease }}
177177
ShowInit: true
178178
ShowRateLimit: true
179179
Script: |
180180
$installed = @(Get-InstalledPSResource -Name GitHub)
181-
$loaded = (Get-Module -Name GitHub).Version
182181
if ($installed.Count -ne 1) {
183-
throw "Expected exactly 1 installed GitHub version (satisfying version reused, no reinstall), but found $($installed.Count): $(($installed.Version) -join ', ')."
182+
throw "Expected exactly 1 installed GitHub version (0.40.0 reused, no extra install), but found $($installed.Count): $(($installed.Version) -join ', ')."
184183
}
185-
if ("$loaded" -ne '0.40.0') {
186-
throw "Expected the already-installed 0.40.0 to be reused, but found '$loaded'."
184+
if ("$($installed.Version)" -ne '0.40.0') {
185+
throw "Expected the retained version to be 0.40.0, but found '$($installed.Version)'."
187186
}
188-
Write-Host "OK: already-installed satisfying version reused ($loaded)"
187+
Write-Host "OK: already-installed satisfying version reused (no reinstall)"
189188
190189
ActionTestWithScript:
191190
name: WithScript

0 commit comments

Comments
 (0)