Mock Version Check API responses in core update tests - #342
Draft
swissspidy wants to merge 1 commit into
Draft
Conversation
Three scenarios install WordPress, downgrade core to an older release and then expect wordpress.org to offer an in-branch (minor) update for it: * core-check-update.feature "Check for update via Version Check API" * core-update.feature "Update to the latest minor release" * core-update.feature "Update WordPress locale when using --minor" Whether that offer is returned at all is decided per site: the Version Check API buckets sites by the URL sent in the `wp_install` request header and only serves the in-branch `autoupdate` offers to some of them. Every test site is installed at the same URL, so all jobs share one bucket, and the bucketing is reshuffled with every WordPress release. After the WordPress 7.1 release that bucket stopped receiving the offers, leaving `wp core check-update` with only the major update to report and `wp core update --minor` with nothing to update to, and all Behat jobs failed on exactly these three scenarios. Mock the version-check response in those scenarios so they no longer depend on which bucket the test site lands in. The offered packages are real, so the updates are still performed against real archives, and the expected versions are now fixed instead of tracking whatever wordpress.org currently considers the latest release of a branch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sevK5u2P9Egf2Vae5QRu6
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates the core check-update and core update feature tests to mock the WordPress Version Check API responses, replacing dynamic version placeholders with fixed, stable test data.
Key Changes
https://api.wordpress.org/core/version-check/1.7/endpoint in three test scenarios to provide consistent, predictable version data{WP_VERSION-latest},{WP_VERSION-5.8-latest}) to exact string matching with hardcoded version numberscore-check-update.feature: Tests now expect versions 5.8.1 (minor) and 6.0 (major)core-update.feature: Tests now expect versions 6.2.11 (minor) and 6.3 (major), and 6.5.10 for locale testsImplementation Details
The mocked API responses include realistic WordPress release data with proper JSON structure, including download URLs, package information, PHP/MySQL version requirements, and response types (upgrade/autoupdate). This approach ensures tests remain stable and reproducible while still validating the actual update functionality with real packages.
https://claude.ai/code/session_011sevK5u2P9Egf2Vae5QRu6