Skip to content

test(db): call parent::tearDown() in DB test classes that skipped it#60744

Draft
miaulalala wants to merge 1 commit into
masterfrom
test/noid/phpunit-db-test-isolation
Draft

test(db): call parent::tearDown() in DB test classes that skipped it#60744
miaulalala wants to merge 1 commit into
masterfrom
test/noid/phpunit-db-test-isolation

Conversation

@miaulalala
Copy link
Copy Markdown
Contributor

Summary

Eight test classes in tests/lib/ override tearDown() for custom DB cleanup but never call parent::tearDown().

Why

TestCase::tearDown() does three things these tests were silently skipping after every single test method:

  • ILockingProvider::releaseAll() — unreleased locks bleed into subsequent tests, causing unexpected deadlocks or NotFoundException
  • Storage::getGlobalCache()->clearCache() — stale filecache entries left behind by share/storage tests cause completely unrelated ObjectStoreStorageTest tests to receive false from fopen(), which then makes fseek() fail with "Argument Name the repository "server" #1 must be of type resource, bool given"
  • UserMountCache::flush() — stale mount cache causes share lookups in later tests to fail with ShareNotFound

These are the root causes of two recurring flaky failures seen in CI:

  • Test\Files\ObjectStore\ObjectStoreStorageTest::testFseekSize
  • Test\Share20\DefaultShareProviderTest::testDeleteSingleShareLazy

Files changed

File Tables cleaned in tearDown
tests/lib/Share20/DefaultShareProviderTest.php share, filecache, storages
tests/lib/Share20/ShareByMailProviderTest.php share, filecache, storages
tests/lib/Files/Config/UserMountCacheTest.php mounts, filecache
tests/lib/SubAdminTest.php users, groups, group_admin
tests/lib/Files/Type/LoaderTest.php mimetypes
tests/lib/Calendar/ResourcesRoomsUpdaterTest.php calendar_resources, calendar_rooms
tests/lib/Preview/PreviewMigrationJobTest.php filecache, preview data
tests/lib/DB/AdapterTest.php appconfig

Test plan

  • DB test suite passes without the two previously-flaky tests appearing

🤖 Generated with Claude Code

Eight test classes overrode tearDown() for custom DB cleanup but never
called parent::tearDown(). TestCase::tearDown() does three things these
tests were silently skipping after every test method:

- ILockingProvider::releaseAll() — unreleased locks bleed into subsequent
  tests and can cause deadlocks or unexpected NotFoundException
- Storage::getGlobalCache()->clearCache() — stale filecache entries from
  share/storage tests cause unrelated ObjectStore tests to receive false
  from fopen() (fseek() then fails with "Argument must be of type resource")
- UserMountCache::flush() — stale mount cache causes share lookups in
  later tests to fail with ShareNotFound

AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala miaulalala self-assigned this May 26, 2026
@miaulalala miaulalala added 3. to review Waiting for reviews tests Related to tests CI labels May 26, 2026
@miaulalala miaulalala added this to the Nextcloud 35 milestone May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews CI tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant