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

Command icon 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

catch created an issue. See original summary.

damiankloip’s picture

We 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.

anavarre’s picture

anavarre’s picture

moshe weitzman’s picture

I no longer see MemcacheBackendUnitTest in 8.x version. Did we lose test coverage over the years?

japerry’s picture

MemcacheBackendUnitTest 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.

ericgsmith’s picture

The 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.

japerry’s picture

Status: Active » Needs work

Thanks 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...

  • japerry committed 3b967741 on 8.x-2.x
    Issue #2996055 by japerry, ericgsmith, Wim Leers: Test coverage
    

japerry credited Wim Leers.

japerry’s picture

Status: Needs work » Fixed

Tests are passing and reliably both locally and on gitlabci! Thanks Wim for the rubber ducking with me!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.