Skip to content

Commit

Permalink
(test) Use no-reduce instead of rude-nupkg-only
Browse files Browse the repository at this point in the history
Switch to use `--no-reduce` to prevent all reduction instead of just
reducing the nupkg.
  • Loading branch information
corbob committed May 10, 2023
1 parent a17a33d commit 12bf790
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,12 @@ To upgrade a local, or remote file, you may use:
$PackageUnderTest = "hasinnoinstaller"
$PackageVersion = '6.2.0.3'

# We'll Need to not reduce the nupkg file if we are running a licensed edition
$null = Invoke-Choco install $PackageUnderTest --version 6.2.0.0 --confirm --no-progress --reduce-nupkg-only
$null = Invoke-Choco install $PackageUnderTest --version 6.2.0.0 --confirm --no-progress --no-reduce

$LockedFile = [System.IO.File]::Open("$env:ChocolateyInstall\lib\$PackageUnderTest\tools\helloworld-1.0.0.exe", 'Open', 'Read',
'Read')

$Output = Invoke-Choco upgrade $PackageUnderTest --version $PackageVersion --confirm --no-progress --reduce-nupkg-only
$Output = Invoke-Choco upgrade $PackageUnderTest --version $PackageVersion --confirm --no-progress --no-reduce
}

AfterAll {
Expand Down Expand Up @@ -393,7 +392,7 @@ To upgrade a local, or remote file, you may use:
$LockedFile = [System.IO.File]::Open("$env:ChocolateyInstall\lib\$PackageUnderTest\tools\a-locked-file.txt", 'OpenOrCreate', 'Read',
'Read')

$null = Invoke-Choco install $PackageUnderTest --version 6.2.0.0 --confirm --no-progress --reduce-nupkg-only
$null = Invoke-Choco install $PackageUnderTest --version 6.2.0.0 --confirm --no-progress --no-reduce

$Output = Invoke-Choco upgrade $PackageUnderTest --version $PackageVersion --confirm --no-progress
}
Expand All @@ -419,14 +418,10 @@ To upgrade a local, or remote file, you may use:
"$env:ChocolateyInstall\lib-bad\$PackageUnderTest\$PackageVersion\$_" | Should -Exist
}

It "Did not create backup of file '<_>' in lib-bad" -ForEach @('hasinnoinstaller.nuspec', 'tools\chocolateyinstall.ps1', 'tools\chocolateyuninstall.ps1', 'tools\helloworld-1.0.0.exe', 'helloworld-1.0.0.exe.ignore') {
It "Did not create backup of file '<_>' in lib-bad" -ForEach @('hasinnoinstaller.nuspec', 'hasinnoinstaller.nupkg', 'tools\chocolateyinstall.ps1', 'tools\chocolateyuninstall.ps1', 'tools\helloworld-1.0.0.exe', 'helloworld-1.0.0.exe.ignore') {
"$env:ChocolateyInstall\lib-bad\$PackageUnderTest\$PackageVersion\$_" | Should -Not -Exist
}

It "Did not create backup of file 'hasinnoinstaller.nupkg' in lib-bad" -Tag FossOnly {
"$env:ChocolateyInstall\lib-bad\$PackageUnderTest\$PackageVersion\$_" | Should -Not Exist
}

It "Outputs a message showing that installation failed." {

$Output.Lines | Should -Contain "Chocolatey upgraded 0/1 packages. 1 packages failed." -Because $Output.String
Expand Down

0 comments on commit 12bf790

Please sign in to comment.