#3941·choco

Add Dev Proxy test to verify choco push reports the server's error response

Author: corbobCreated Sep 23, 2026Updated Sep 23, 2026
LabelsBuild AutomationTestsClickUp - QA

Is Your Feature Request Related To A Problem? Please describe.

The choco push Pester tests in tests/pester-tests/commands/choco-push.Tests.ps1 check two separate things together:

  1. That the Chocolatey Community Repository returns the right error when a push is rejected: the version already exists, the description is over 4000 characters, or the title is over 256 characters.
  2. That Chocolatey CLI shows that server error to the user.

Outside a CCR Test Kitchen, these tests push to https://push.chocolatey.org/. The response goes through Cloudflare, and the 409 reason phrase that carried CCR's message usually reaches Chocolatey CLI as plain Conflict. Every push test now gets this line:

Response status code does not indicate success: 409 (Conflict).

This fails on Windows Server 2016, 2019, 2022 and 2025, on develop and on PR builds alike, so it isn't caused by any change to Chocolatey CLI. The tests are now failing because of how an external proxy treats responses, and the part that actually belongs to Chocolatey CLI (showing the server's error) is no longer tested against a known response.

The interim fix for #3910 keeps the strict checks only when running in a CCR Test Kitchen, where the push goes straight to http://localhost/. Everywhere else it only checks for a 409. So outside CCR, nothing currently checks that Chocolatey CLI reports the cause of a failed push.

Describe The Solution. Why is it needed?

Add a Pester test that pushes to a Dev Proxy endpoint set up to return a known failure. The test then checks that Chocolatey CLI shows that failure's details to the user.

This gives the two concerns separate homes:

  • CCR behaviour (the right 409 details for an existing version, a description that's too long, a title that's too long) stays with the CCR Test Kitchen tests, which push to CCR directly with no proxy in between.
  • Chocolatey CLI behaviour (the server's error details are passed on to the user) is tested against a response we control, so it doesn't depend on CCR, Cloudflare or network conditions.

Before building the mock, decide which part of the response the test targets:

  • The reason phrase is how CCR carries the message today. Proxies can rewrite reason phrases, and HTTP/2 doesn't have them at all, which is the likely cause of the current failures. Also, it isn't yet confirmed that Dev Proxy can send a custom reason phrase.
  • The response body would hold up better. If Chocolatey CLI doesn't read the body today, that's a Chocolatey CLI change, and possibly a CCR change too, and should get its own issue.

Once this test is in place, the non-CCR branch of the existing push tests can be removed or cut back to a basic 409 check.

User Story

As a Chocolatey Developer, I want the choco push error-reporting tests to run against a known server response, so that they only fail when Chocolatey CLI stops showing the server's error, not when an external proxy changes how it handles responses.

Additional Context

  • Seen in the TeamCity Test Kitchen runs TestKitchen_Chocolatey-735 and 736 (2026-09-22 and 2026-09-23). The same 3 tests failed on all four Windows Server instances in both runs: Pushing package version that already exists, Pushing package description more than 4000 characters, and Pushing package title more than 256 characters, each at Should Report the actual cause of the error. develop shows the same failures.
  • In both runs, the only 409 line Chocolatey CLI saw was Response status code does not indicate success: 409 (Conflict).
  • The CCR Test Kitchen tells itself apart by the presence of c:\elasticsearch-setup\ccr-apikey.txt and pushes to http://localhost/.

Acceptance Criteria

  • A Pester test pushes a package to a Dev Proxy endpoint that returns a known failure response, and checks that Chocolatey CLI shows that response's error details.
  • It's decided and documented whether the test targets the reason phrase or the response body, and a follow-up issue exists if Chocolatey CLI needs to change.
  • The test doesn't need network access to push.chocolatey.org or CCR.
  • The test passes in Test Kitchen on all supported Windows Server versions.
  • The CCR-specific push checks run only in the CCR Test Kitchen.

Related Issues

  • #3910

┆Issue is synchronized with this Clickup task by Unito