From 9ca4359959c09a51a0f6a1dd8e33211ff3994800 Mon Sep 17 00:00:00 2001 From: Cory Knox Date: Mon, 1 Jun 2026 14:55:36 -0700 Subject: [PATCH 1/2] (tests) Disable other sources on upgrade all tests Disable all sources on the upgrade all tests and only enable the hermes source. This is to resolve issues we see when there are newer Chocolatey product versions available on hermes-setup than what was installed intially. --- tests/pester-tests/commands/choco-upgrade.Tests.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/pester-tests/commands/choco-upgrade.Tests.ps1 b/tests/pester-tests/commands/choco-upgrade.Tests.ps1 index 7d3121a732..c1156889ec 100644 --- a/tests/pester-tests/commands/choco-upgrade.Tests.ps1 +++ b/tests/pester-tests/commands/choco-upgrade.Tests.ps1 @@ -2,6 +2,8 @@ BeforeAll { Remove-NuGetPaths Initialize-ChocolateyTestInstall + Disable-ChocolateySource -All + Enable-ChocolateySource -Name hermes New-ChocolateyInstallSnapshot $features = Get-ChocolateyFeatures From 3863e1d81ba81e6954761a0e4b28e3a65294932b Mon Sep 17 00:00:00 2001 From: Cory Knox Date: Mon, 1 Jun 2026 15:00:28 -0700 Subject: [PATCH 2/2] (tests) Account for different push messages This updates the push tests to account for the different results when pushing directly and indirectly. --- tests/pester-tests/commands/choco-push.Tests.ps1 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/pester-tests/commands/choco-push.Tests.ps1 b/tests/pester-tests/commands/choco-push.Tests.ps1 index 641826fc0b..8f0e2820d3 100644 --- a/tests/pester-tests/commands/choco-push.Tests.ps1 +++ b/tests/pester-tests/commands/choco-push.Tests.ps1 @@ -78,9 +78,13 @@ Describe "choco push" -Tag Chocolatey, PushCommand, ProxySkip, CCR -Skip:($null } It "Should Report the actual cause of the error" { + $expectedErrors = @( + "Response status code does not indicate success: 409 (This package had an issue pushing: A nuget package's Description property may not be more than 4000 characters long.)." # Direct + "Response status code does not indicate success: 409 (Conflict)." # Indirect + ) $Output.Lines | Should -Contain "Attempting to push $PackageUnderTest.$VersionUnderTest.nupkg to $RepositoryToUse" -Because $Output.String $Output.Lines | Should -Contain "An error has occurred. It's possible the package version already exists on the repository or a nuspec element is invalid. See error below..." -Because $Output.String - $Output.Lines | Should -Contain "Response status code does not indicate success: 409 (This package had an issue pushing: A nuget package's Description property may not be more than 4000 characters long.)." -Because $Output.String + $Output.Lines -contains $expectedErrors | Should -BeTrue -Because $Output.String } } @@ -108,9 +112,13 @@ Describe "choco push" -Tag Chocolatey, PushCommand, ProxySkip, CCR -Skip:($null } It "Should Report the actual cause of the error" { + $expectedErrors = @( + "Response status code does not indicate success: 409 (This package had an issue pushing: A nuget package's Title property may not be more than 256 characters long.)." #Direct + "Response status code does not indicate success: 409 (Conflict)." # Indirect + ) $Output.Lines | Should -Contain "Attempting to push $PackageUnderTest.$VersionUnderTest.nupkg to $RepositoryToUse" -Because $Output.String $Output.Lines | Should -Contain "An error has occurred. It's possible the package version already exists on the repository or a nuspec element is invalid. See error below..." -Because $Output.String - $Output.Lines | Should -Contain "Response status code does not indicate success: 409 (This package had an issue pushing: A nuget package's Title property may not be more than 256 characters long.)." -Because $Output.String + $Output.Lines -contains $expectedErrors | Should -BeTrue -Because $Output.String } }