forked from chocolatey/choco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(chocolatey#1443) Add E2E tests for remember upgrade args
- Loading branch information
1 parent
3f17450
commit 75947c3
Showing
1 changed file
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
Import-Module helpers/common-helpers | ||
|
||
Describe "choco install" -Tag Chocolatey, InstallCommand { | ||
BeforeAll { | ||
Initialize-ChocolateyTestInstall | ||
|
||
New-ChocolateyInstallSnapshot | ||
} | ||
|
||
AfterAll { | ||
Remove-ChocolateyTestInstall | ||
} | ||
|
||
Context "Upgrading packages while remembering arguments with only one package using arguments" { | ||
BeforeAll { | ||
Restore-ChocolateyInstallSnapshot | ||
|
||
$null = Enable-ChocolateyFeature useRememberedArgumentsForUpgrades | ||
$null = Invoke-Choco install curl --package-parameters="'/CurlOnlyParam'" --version="7.77.0" --ia="'/CurlIAParam'" --forcex86 -y | ||
$null = Invoke-Choco install wget --version=1.21.1 -y | ||
|
||
$Output = Invoke-Chocoupgrade all -y --debug | ||
} | ||
|
||
It 'Exits with Success (0)' { | ||
$Output.ExitCode | Should -Be 0 | ||
} | ||
|
||
It 'Outputs running curl script with correct arguments' { | ||
$line = $Output.Lines | ? { $_ -match "packageScript.*curl\\tools" } | ||
|
||
$line | Should -Not -BeNullOrEmpty | ||
$line | Should -Contain "/CurlIAParam" | ||
$line | Should -Contain "/CurlOnlyParam" | ||
$line | Should -Contain "-forceX86" | ||
} | ||
|
||
It 'Outputs running wget script with correct arguments' { | ||
$line = $Output.Lines | ? { $_ -match "packageScript.*curl\\tools" } | ||
|
||
$line | Should -Not -BeNullOrEmpty | ||
$line | Should -Contain "installArguments: ''" | ||
$line | Should -Contain "packageParameters: ''" | ||
$line | Should -Not -Contain "-forceX86" | ||
} | ||
} | ||
|
||
Context "Upgrading packages while remembering arguments with multiple packages using arguments" { | ||
BeforeAll { | ||
Restore-ChocolateyInstallSnapshot | ||
|
||
$null = Enable-ChocolateyFeature useRememberedArgumentsForUpgrades | ||
$null = Invoke-Choco install curl --package-parameters="'/CurlOnlyParam'" --version="7.77.0" --ia="'/CurlIAParam'" --forcex86 -y | ||
$null = Invoke-Choco install wget --version=1.21.1 -y --forcex86 | ||
$null = Invoke-Choco install firefox --version=99.0.1 --package-parameters="'/l=eu'" -y --ia="'/RemoveDistributionDir=true'" | ||
|
||
$Output = Invoke-Chocoupgrade all -y --debug | ||
} | ||
|
||
It 'Exits with Success (0)' { | ||
$Output.ExitCode | Should -Be 0 | ||
} | ||
|
||
It 'Outputs running curl script with correct arguments' { | ||
$line = $Output.Lines | ? { $_ -match "packageScript.*curl\\tools" } | ||
|
||
$line | Should -Not -BeNullOrEmpty | ||
$line | Should -Contain "installArguments: '/CurlIAParam'" | ||
$line | Should -Contain "packageParameters: '/CurlOnlyParam'" | ||
$line | Should -Contain "-forceX86" | ||
} | ||
|
||
It 'Outputs running wget script with correct arguments' { | ||
$line = $Output.Lines | ? { $_ -match "packageScript.*wget\\tools" } | ||
|
||
$line | Should -Not -BeNullOrEmpty | ||
$line | Should -Contain "installArguments: ''" | ||
$line | Should -Contain "packageParameters: ''" | ||
$line | Should -Contain "-forceX86" | ||
} | ||
|
||
It 'Outputs firefox using eu as language locale' { | ||
$Output.Lines | Should -Contain "Using locale 'eu'..." | ||
} | ||
|
||
It 'Outputs running firefox script with correct arguments' { | ||
$line = $Output.Lines | ? { $_ -match "packageScript.*firefox\\tools" } | ||
|
||
$line | Should -Not -BeNullOrEmpty | ||
$line | Should -Contain "installArguments: '/RemoveDistributionDir=true'" | ||
$line | Should -Contain "packageParameters: '/l=eu'" | ||
$line | Should -Not -Contain "-forceX86" | ||
} | ||
|
||
} | ||
} |