Skip to content

Commit

Permalink
(tests) Enhance Invoke-Choco to force proxy use
Browse files Browse the repository at this point in the history
We're adding some Test Kitchen instances that set custom environment
variables so that we can test the proxy parameters. This enhances the
`Invoke-Choco` function to look for these variables and add the proxy
parameters to the command.

(cherry picked from commit 06825fe)

# Conflicts:
#	tests/helpers/common/Chocolatey/Invoke-Choco.ps1
  • Loading branch information
corbob authored and vexx32 committed Feb 21, 2023
1 parent f1f909c commit 388b3f6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/helpers/common/Chocolatey/Invoke-Choco.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,21 @@
begin {
$chocoPath = Get-ChocoPath
$firstArgument, [string[]]$remainingArguments = $Arguments
$arguments = @($firstArgument; '--allow-unofficial'; $remainingArguments)
$arguments = @(
$firstArgument
'--allow-unofficial'

if ($env:CHOCO_TEST_PROXY) {
"--proxy='$($env:CHOCO_TEST_PROXY)'"
if ($env:CHOCO_TEST_PROXY_USER) {
"--proxy-user='$($env:CHOCO_TEST_PROXY_USER)'"
"--proxy-password='$($env:CHOCO_TEST_PROXY_PASSWORD)'"
}
}

$remainingArguments
)

}
end {
$output = if ($PipelineInput) {
Expand Down

0 comments on commit 388b3f6

Please sign in to comment.