Problem/Motivation
Drupal\KernelTests\Core\Entity\ConfigEntityQueryTest::testCaseSensitivity can randomly fail.
1) Drupal\KernelTests\Core\Entity\ConfigEntityQueryTest::testCaseSensitivity
Failed asserting that 4 is identical to 3.
https://www.drupal.org/pift-ci-job/1508229
This is because entities with a label containing the word 'test' (e.g. '12test78') are occasionally generated.
$entity = ConfigQueryTest::create([
'label' => $this->randomMachineName(),
'id' => '1',
'number' => 31,
'array' => $array,
]);
// Filter by label with a known containing case-sensitive word.
$this->queryResults = $this->entityStorage->getQuery()
->condition('label', 'TEST', 'CONTAINS')
->execute();
$this->assertResults(['3', '4', '5']);
Proposed resolution
Use something like 'entity_1' 'entity_2'... as each label.
Comments
Comment #2
krzysztof domańskiComment #4
spokjeSimple patch, probably much harder to find out where this (former) random test failure came from.
Nice catch, RTBC for me!
Comment #5
alexpottWell there are quite a few other uses of $this->randomMachineName() in this test. I'd remove them all an hardcode something like 'entity_1' 'entity_2'... as each label
Comment #6
krzysztof domańskiComment #7
mradcliffeI am triaging this task and I think that this is still a Novice issue. I added the Needs issue summary update to update Proposed resolution with the suggestion by @alexpott in #5.
Comment #8
SpringbokAgency commentedComment #9
SpringbokAgency commentedSomething like this? I replaced all uses of $this->randomMachineName() as suggested in comment #5.
Comment #10
rakesh.gectcr@DukeandGrace Thanks for contributing, Please add the interdiff, So that will be easy for the reviewers to review your patches.
Please see how to make interdiff https://www.drupal.org/documentation/git/interdiff
Comment #11
SpringbokAgency commentedComment #12
krzysztof domańskiComment #13
krzysztof domańskiMaybe it's better to use
config_entity_but IMHOentity_also looks good.Comment #14
alexpottCommitted and pushed 45b3d06dce to 9.0.x and 9067d423cd to 8.9.x and c435596c6f to 8.8.x. Thanks!
Backported to 8.8.x as a test-only change.
Comment #18
krzysztof domańskiComment #20
xjm