Skip to content

test: de-flake RelationsChecksumListenerTest media lookups#493

Merged
turegjorup merged 3 commits into
release/3.0.0from
fix/deflake-relations-checksum-test
Jun 10, 2026
Merged

test: de-flake RelationsChecksumListenerTest media lookups#493
turegjorup merged 3 commits into
release/3.0.0from
fix/deflake-relations-checksum-test

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

Summary

RelationsChecksumListenerTest failed intermittently in CI (seen on PR #492's PHP Unit tests (mariadb:10.11) job) with Undefined array key "media". Three tests picked an arbitrary tenant-ABC slide via an unordered findOneBy(['tenant' => $tenant]) and then read the media checksum key. The fixtures contain slide_abc_notified, which has no media (and therefore no media checksum key), so the tests crashed whenever the database happened to return that row first.

Files Changed

  • tests/EventListener/RelationsChecksumListenerTest.php - testUpdateMedia, testAddMediaToSlideUpdatesChecksum and testRemoveMediaFromSlideUpdatesChecksum now look up slide_abc_1 by title (guaranteed media in fixtures/slide.yaml), matching the deterministic lookups the other tests in the class already use
  • CHANGELOG.md - entry under [Unreleased]

Test Plan

  • CI PHPUnit matrix (mariadb 10.11 + 11.4) runs the full test class.
  • The previously failing path is now impossible: the three media tests can no longer select a slide without media.

🤖 Generated with Claude Code

turegjorup and others added 2 commits June 10, 2026 15:48
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
@turegjorup turegjorup self-assigned this Jun 10, 2026
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>
@turegjorup
turegjorup merged commit cf938cc into release/3.0.0 Jun 10, 2026
20 checks passed
@turegjorup
turegjorup deleted the fix/deflake-relations-checksum-test branch June 10, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant