Skip to content

Retry chocolatey installer download on transient HTTP errors in test fixture - #70105

Merged
dwoz merged 1 commit into
saltstack:3006.xfrom
dwoz:fix/nightly-chocolatey-504
Aug 21, 2026
Merged

dwoz merged 1 commit into
saltstack:3006.xfrom
dwoz:fix/nightly-chocolatey-504

Conversation

@dwoz

@dwoz dwoz commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Hardens the chocolatey_mod module-scoped fixture in
tests/pytests/functional/states/test_chocolatey_latest.py so that the
Windows nightly functional zeromq 3 jobs stop failing every time the
Chocolatey Community Repository (community.chocolatey.org) returns a
transient HTTP 5xx / 429 from its CDN.

Two-layer fix, both applied:

  1. Retry the cp.get_url call for the installer nupkg with exponential
    backoff (up to 5 attempts, cap ~30s per sleep) on the transient
    markers: HTTP 502/503/504/429, connection resets, read timeouts.
  2. If retries exhaust, pytest.skip with a message naming the failure
    count and the last error. This is not a skipif at collection
    time hiding a Salt bug — it fires only when the external service is
    genuinely down, and the tests literally cannot run without the
    installer download.

What issues does this PR fix or reference?

No open issue — surfaced by the nightly job failure:

Both nights, both Windows 2022 and Windows 2025, the
Test Salt / Windows <year> functional zeromq 3 job failed at
chocolatey_mod fixture setup with:

salt.exceptions.MinionError: Error: HTTP 504: Gateway Timeout reading /api/v2/package/chocolatey/

Previous Behavior

Any transient blip from community.chocolatey.org made the fixture
raise on the first call, erroring all five tests
(test_installed_latest, test_installed_version,
test_installed_version_existing_capitalization, test_uninstalled,
test_upgraded) at setup.

New Behavior

Transient HTTP errors are retried with backoff; if the service is
still down after the retry budget is exhausted, the tests are skipped
at runtime with a clear message rather than reported as errors.

Merge-forward

This will merge forward to 3007.x / 3008.x / master via the standard
merge-forward branches. No sibling PRs.

Test-only change

This is a test-fixture hardening only. No production Salt code is
touched, so no changelog fragment. A regression test for this class of
fix is impractical — it would require simulating community.chocolatey.org
returning HTTP 504.

Merge requirements satisfied?

  • Docs (n/a — test infrastructure)
  • Changelog (n/a — test-only fixture change)
  • Tests written/updated (this is a test fixture change)

Commits signed with GPG?

Yes

The chocolatey_mod fixture in test_chocolatey_latest.py downloads the
Chocolatey installer nupkg from community.chocolatey.org. The service
periodically returns HTTP 5xx/429 from its CDN, breaking every Windows
functional test run in the nightly build. Retry the download with
exponential backoff on transient HTTP errors and skip the tests at
runtime if the service remains unavailable — the tests literally cannot
execute without the installer download, so a runtime skip is the
correct semantic when the external dependency is genuinely down.
@dwoz
dwoz requested a review from a team as a code owner August 20, 2026 22:26
@dwoz dwoz added this to the Sulphur v3006.28 milestone Aug 20, 2026
@dwoz dwoz added the test:full Run the full test suite label Aug 20, 2026
@dwoz
dwoz merged commit 9ed7f75 into saltstack:3006.x Aug 21, 2026
439 of 444 checks passed
dwoz added a commit to dwoz/salt that referenced this pull request Aug 24, 2026
Port of 3006.x fix saltstack#70105 (915b4c8) to the 3007.x test file layout.
3007.x has chocolatey/test_post_20.py where 3006.x has
test_chocolatey_latest.py -- same fixture pattern, same upstream flake.

The chocolatey_mod fixture downloads the Chocolatey installer nupkg from
community.chocolatey.org. The service periodically returns HTTP 5xx/429
from its CDN, breaking every Windows functional test run in the nightly
build. Retry the download with exponential backoff on transient HTTP
errors and skip the tests at runtime if the service remains
unavailable -- the tests literally cannot execute without the installer
download, so a runtime skip is the correct semantic when the external
dependency is genuinely down.
dwoz added a commit to dwoz/salt that referenced this pull request Aug 25, 2026
Port of 3006.x fix saltstack#70105 (915b4c8) to the 3007.x test file layout.
3007.x has chocolatey/test_post_20.py where 3006.x has
test_chocolatey_latest.py -- same fixture pattern, same upstream flake.

The chocolatey_mod fixture downloads the Chocolatey installer nupkg from
community.chocolatey.org. The service periodically returns HTTP 5xx/429
from its CDN, breaking every Windows functional test run in the nightly
build. Retry the download with exponential backoff on transient HTTP
errors and skip the tests at runtime if the service remains
unavailable -- the tests literally cannot execute without the installer
download, so a runtime skip is the correct semantic when the external
dependency is genuinely down.
@dwoz
dwoz deleted the fix/nightly-chocolatey-504 branch November 13, 2026 08:29

This branch was previously deployed

1 inactive deployment
ci — 915b4c80 Deployed Aug 20, 2026 by dwoz via Build Onedir Packages / RPM (x86_64) #26527
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant