Problem/Motivation
We have some old DrupalWebTests which I haven't been able to get to complete locally yet, and one phpunit unit test that doesn't do very much.
Core now has GenericCacheBackendUnitTestBase which will give us decent test coverage more or less for free. Might need to do a bit of additional work to test cache tags (see DatabaseBackendTagTest).
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork memcache-2996055
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
damiankloip commentedWe do already have MemcacheBackendUnitTest that extends GenericCacheBackendUnitTestBase. DatabaseBackendTagTest looks like it could be similarly useful, but invalidations via the backend are covered by \Drupal\KernelTests\Core\Cache\GenericCacheBackendUnitTestBase::testInvalidateTags too. The tag test looks like it'd be good to check when we're actually writing tags though.
Comment #3
anavarreComment #4
anavarreComment #5
moshe weitzman commentedI no longer see MemcacheBackendUnitTest in 8.x version. Did we lose test coverage over the years?
Comment #6
japerryMemcacheBackendUnitTest was moved/renamed to the MemcacheBackendTest in 2018 by Damian.
https://git.drupalcode.org/project/memcache/-/commit/f30543ba2d991e5fd06...
There isn't any issue associated with it, but I'm guessing it had to do with the bootstrapping of memcache. Interestingly its still referencing GenericCacheBackendUnitTestBase -- so I'm not sure why it was moved out of a unit test.
Comment #7
ericgsmith commentedThe existing failures have come up in a couple of issues, #2996615: Transaction support for cache (tags) invalidation and #3397864: Add optional DDEV dev environment
Debugging I found that a lot of times where the get is called the cache item created and last bin deleted timestamps were the same - so the data is returned from memcache but when timeIsGreaterThanBinDeletionTime is called in the memcache backed, the timestamps are equal so it returns false and doesn't return anything from the cache backend service.
I tried in https://git.drupalcode.org/project/memcache/-/merge_requests/22/diffs?co... to reduce the tolerance to 0 and that greatly reduced the number of test failures, but not all of them - so I suspect there are additional issues, or the tolerance of 0 is still somehow flakey.
If think it makes sense to tackle the existing failures in this issue first so just cross posting here.
Comment #10
japerryThanks ericgsmith for the MR! I've been playing around with the test failures as well to no avail. Going to merge in your MR for now but keep this issue open and NW due to the remaining failures...
Comment #14
japerryTests are passing and reliably both locally and on gitlabci! Thanks Wim for the rubber ducking with me!