From a9f177e7438f1fa67462d3c09a397396d1625c58 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Tue, 26 May 2026 21:20:57 +0200 Subject: [PATCH] test(db): call parent::tearDown() in DB test classes that skipped it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Anna Larch --- tests/lib/Calendar/ResourcesRoomsUpdaterTest.php | 1 + tests/lib/DB/AdapterTest.php | 1 + tests/lib/Files/Config/UserMountCacheTest.php | 1 + tests/lib/Files/Type/LoaderTest.php | 1 + tests/lib/Preview/PreviewMigrationJobTest.php | 1 + tests/lib/Share20/DefaultShareProviderTest.php | 1 + tests/lib/Share20/ShareByMailProviderTest.php | 1 + tests/lib/SubAdminTest.php | 1 + 8 files changed, 8 insertions(+) diff --git a/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php b/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php index 548b87222c5b4..5ace218a02073 100644 --- a/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php +++ b/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php @@ -68,6 +68,7 @@ protected function tearDown(): void { $query->delete('calendar_resources_md')->executeStatement(); $query->delete('calendar_rooms')->executeStatement(); $query->delete('calendar_rooms_md')->executeStatement(); + parent::tearDown(); } /** diff --git a/tests/lib/DB/AdapterTest.php b/tests/lib/DB/AdapterTest.php index 23ac53b0f5ce9..4ed4fdbd00388 100644 --- a/tests/lib/DB/AdapterTest.php +++ b/tests/lib/DB/AdapterTest.php @@ -29,6 +29,7 @@ public function tearDown(): void { ->from('appconfig') ->where($qb->expr()->eq('appid', $qb->createNamedParameter($this->appId))) ->executeStatement(); + parent::tearDown(); } public function testInsertIgnoreOnConflictDuplicate(): void { diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php index ddc18c44f4474..c9cfccc5ee615 100644 --- a/tests/lib/Files/Config/UserMountCacheTest.php +++ b/tests/lib/Files/Config/UserMountCacheTest.php @@ -90,6 +90,7 @@ protected function tearDown(): void { ->where($builder->expr()->eq('fileid', new Literal($fileId))) ->executeStatement(); } + parent::tearDown(); } private function getStorage($storageId, $rootInternalPath = '') { diff --git a/tests/lib/Files/Type/LoaderTest.php b/tests/lib/Files/Type/LoaderTest.php index f9b30fbefd55f..2aaf4c5067c50 100644 --- a/tests/lib/Files/Type/LoaderTest.php +++ b/tests/lib/Files/Type/LoaderTest.php @@ -31,6 +31,7 @@ protected function tearDown(): void { 'mimetype', $deleteMimetypes->createPositionalParameter('testing/%') )); $deleteMimetypes->executeStatement(); + parent::tearDown(); } diff --git a/tests/lib/Preview/PreviewMigrationJobTest.php b/tests/lib/Preview/PreviewMigrationJobTest.php index 0992cdc2c1f18..2f769d79d24ed 100644 --- a/tests/lib/Preview/PreviewMigrationJobTest.php +++ b/tests/lib/Preview/PreviewMigrationJobTest.php @@ -103,6 +103,7 @@ public function tearDown(): void { $qb->delete('filecache') ->where($qb->expr()->eq('fileid', $qb->createNamedParameter(5))) ->executeStatement(); + parent::tearDown(); } #[TestDox('Test the migration from the legacy flat hierarchy to the new database format')] diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index 470a48adde2b9..1881c02c83d2d 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -127,6 +127,7 @@ protected function tearDown(): void { $this->dbConn->getQueryBuilder()->delete('share')->executeStatement(); $this->dbConn->getQueryBuilder()->delete('filecache')->runAcrossAllShards()->executeStatement(); $this->dbConn->getQueryBuilder()->delete('storages')->executeStatement(); + parent::tearDown(); } /** diff --git a/tests/lib/Share20/ShareByMailProviderTest.php b/tests/lib/Share20/ShareByMailProviderTest.php index bcc6c8a497715..f37e5fb9f9ff7 100644 --- a/tests/lib/Share20/ShareByMailProviderTest.php +++ b/tests/lib/Share20/ShareByMailProviderTest.php @@ -134,6 +134,7 @@ protected function tearDown(): void { $this->dbConn->getQueryBuilder()->delete('share')->executeStatement(); $this->dbConn->getQueryBuilder()->delete('filecache')->runAcrossAllShards()->executeStatement(); $this->dbConn->getQueryBuilder()->delete('storages')->executeStatement(); + parent::tearDown(); } /** diff --git a/tests/lib/SubAdminTest.php b/tests/lib/SubAdminTest.php index 0086415019f08..7175c2dedae38 100644 --- a/tests/lib/SubAdminTest.php +++ b/tests/lib/SubAdminTest.php @@ -100,6 +100,7 @@ protected function tearDown(): void { ->where($qb->expr()->eq('uid', $qb->createNamedParameter('orphanedUser'))) ->orWhere($qb->expr()->eq('gid', $qb->createNamedParameter('orphanedGroup'))) ->executeStatement(); + parent::tearDown(); } public function testCreateSubAdmin(): void {