Skip to content

Commit

Permalink
(chocolatey#2884) Add tests for config backup
Browse files Browse the repository at this point in the history
In v1.2.0 choco would fall to pieces on being asked to upgrade multiple
packages in a a single command, or when upgrading a package that also
needed to upgrade a dependency. The second package installation would
fail.

This regression test ensures that we can safely `upgrade` multiple
packages at once.
  • Loading branch information
vexx32 committed Dec 6, 2022
1 parent 069d29b commit 98279b2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,26 @@ Describe "choco upgrade" -Tag Chocolatey, UpgradeCommand {
$line | Should -Not -Match "-forceX86"
}
}


Context "Upgrading multiple packages at once" {

BeforeAll {
Restore-ChocolateyInstallSnapshot

$PackageUnderTest = "installpackage", "packagewithscript"

$Output = Invoke-Choco upgrade @PackageUnderTest --confirm
}

It "Installs successfully and exits with success (0)" {
$Output.ExitCode | Should -Be 0
}

It "Installed the packages to the lib directory" {
$PackageUnderTest | ForEach-Object {
"$env:ChocolateyInstall\lib\$_" | Should -Exist
}
}
}
}

0 comments on commit 98279b2

Please sign in to comment.