Skip to content

Commit

Permalink
(tests) Clear HTTP Cache before getting packages
Browse files Browse the repository at this point in the history
  • Loading branch information
corbob committed Jul 12, 2023
1 parent 9c470f1 commit e52ea78
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions tests/chocolatey-tests/commands/choco-push.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Describe 'choco push nuget <_> repository' -Tag Chocolatey, PushCommand -Skip:($
}

$Output = Invoke-Choco push $PackagePath --source $RepositoryToUse$RepositoryEndpoint @KeyParameter

Invoke-Choco cache remove
$VerifyPackagesSplat = @(
"--pre"
"--source"
Expand All @@ -172,15 +172,7 @@ Describe 'choco push nuget <_> repository' -Tag Chocolatey, PushCommand -Skip:($
"--version"
"$VersionUnderTest-$AddedVersion"
)

# Nexus can take a moment to index the package, but we want to validate that it was successfully pushed
$Timer = [System.Diagnostics.Stopwatch]::StartNew()
while ($Timer.Elapsed.TotalSeconds -lt 300 -and -not (
$Packages = (Invoke-Choco find $PackageUnderTest @VerifyPackagesSplat --Limit-Output).Lines | ConvertFrom-ChocolateyOutput -Command List
)) {
Write-Verbose "$($PackageUnderTest) was not found on $($RepositoryToUse)$($RepositoryEndpoint). Waiting for 5 seconds before trying again."
Start-Sleep -Seconds 5
}
$Packages = (Invoke-Choco find $PackageUnderTest @VerifyPackagesSplat --Limit-Output).Lines | ConvertFrom-ChocolateyOutput -Command List
}

AfterAll {
Expand Down

0 comments on commit e52ea78

Please sign in to comment.