Problem/Motivation
I haven't seen reports of this happening in testbot but I'm sure it will. On my local testing jobs I'm getting random test failures because EntityUnitTest is using random values for test data.
The problem is that in EntityUnitTest::testCacheTags it is adding and removing values form tags and testing an explicit return value. \Drupal\Core\Cache\Cache::mergeTags runs a sort over the tag array though so they are always ordered. This means that when the entityTypeName is alphabetically lower then the test tag we will get a failure.
Proposed resolution
I'd prefer to use and explicit value for the type instead of a random machine name but I'm not sure there will be support for that. The attached patch just sorts the expected values, mimicking the mergeTags behavior.
This is a follow up to #2512718: EntityManager::getTranslationFromContext() should add the content language cache context to the entity
| Comment | File | Size | Author |
|---|---|---|---|
| random_failures_in_EntityUnitTest.patch | 919 bytes | neclimdul |
Comments
Comment #1
daffie commentedWe have had these kind of sort problems before in test.
Looks good to me.
Comment #2
larowlanYep saw this on two issues yesterday
Comment #3
alexpottNice find and fix @neclimdul.
Committed a87f47d and pushed to 8.0.x. Thanks!