Repository navigation
Tests: Cover transient timeout handling with and without an external object cache - #1
Open
AceMedia wants to merge 1 commit into
Conversation
…object cache. Adds regression coverage alongside the change for transients stored without their timeout row. The new tests check the row layout and autoload state on the database path, the value-insert failure path, and that an unrelated earlier database error does not block setting a transient over an orphaned timeout row. They also check that, with an external object cache, transients and site transients use only the object cache and never write or query option rows. The external cache is simulated by flagging the default in-memory cache as external. See https://core.trac.wordpress.org/ticket/52345 Props dhrupo.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Trac ticket: https://core.trac.wordpress.org/ticket/52345
This adds regression tests on top of dhrupo's work in WordPress#14340. It is built on their exact head (5a233df) and changes no production code. I am offering it as a tests-only commit for you to take or leave.
Two other open PRs touch the same transient functions and the same test files, so I have kept clear of them: WordPress#13101 (#65863, orphaned timeout rows on delete) and WordPress#12523 (#33561, return false when the timeout row is missing). I did not build on either. They edit different parts of option.php, but all three append tests to the end of the same test files, so those hunks will need a rebase whichever lands first.
What the tests cover
On the database path (no external object cache):
With an external object cache (simulated):
These run on single site and multisite.
Results
Run through my local setup on PHP 8.4.25, PHPUnit 9.6.35 and MariaDB 10.11.18: Tests_Option_Transient 21 tests, 89 assertions, and Tests_Option_SiteTransient 13 tests, 46 assertions, each with one skip, on both single site and multisite. PHPCS is clean on the two files.
With the PR's src change reverted to its base, only the three failure-path tests the PR already contains fail. All of my added tests pass there as well. They are guards on the changed code paths and on the external cache behaviour rather than tests of a new defect, and I would rather say so than imply otherwise.
Limits
AI assistance: Codex and Claude helped me assess the issue, write the tests and run the checks. I have reviewed the code myself. The test results are from automated runs through my local test setup.