test: de-flake RelationsChecksumListenerTest media lookups#493
Merged
Conversation
testUpdateMedia, testAddMediaToSlideUpdatesChecksum and
testRemoveMediaFromSlideUpdatesChecksum picked an arbitrary tenant-ABC
slide with an unordered findOneBy() and then read the 'media' checksum
key. The fixture set contains slide_abc_notified, which has no media and
therefore no 'media' key, so the tests failed whenever the database
happened to return that row first ("Undefined array key 'media'").
Look up slide_abc_1 by title instead — it is guaranteed media in
fixtures/slide.yaml — matching the deterministic lookups the other tests
in the class already use.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…relations-checksum-test # Conflicts: # CHANGELOG.md
Pinning slide_abc_1 by title was still flaky: testRemoveSlide() deletes the oldest slide of playlist_abc_1, and with randomised fixture createdAt values that is sometimes slide_abc_1 itself — the lookup then returned null on the shared per-class database. Add slide_media_checksum_test (tenant ABC, two known media, attached to no playlist) following the existing *_relations_checksum_test fixture convention, and use it in the three media checksum tests. No other test can mutate or delete it. The ABC slide count grows to 62, so bump the totalItems assertion in SlidesTest. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
RelationsChecksumListenerTestfailed intermittently in CI (seen on PR #492'sPHP Unit tests (mariadb:10.11)job) withUndefined array key "media". Three tests picked an arbitrary tenant-ABC slide via an unorderedfindOneBy(['tenant' => $tenant])and then read themediachecksum key. The fixtures containslide_abc_notified, which has no media (and therefore nomediachecksum key), so the tests crashed whenever the database happened to return that row first.Files Changed
tests/EventListener/RelationsChecksumListenerTest.php-testUpdateMedia,testAddMediaToSlideUpdatesChecksumandtestRemoveMediaFromSlideUpdatesChecksumnow look upslide_abc_1by title (guaranteed media infixtures/slide.yaml), matching the deterministic lookups the other tests in the class already useCHANGELOG.md- entry under[Unreleased]Test Plan
🤖 Generated with Claude Code