mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
test(db): call parent::tearDown() in DB test classes that skipped it
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>
This commit is contained in:
parent
0a4d4bc8ab
commit
a9f177e743
8 changed files with 8 additions and 0 deletions
|
|
@ -68,6 +68,7 @@ class ResourcesRoomsUpdaterTest extends TestCase {
|
|||
$query->delete('calendar_resources_md')->executeStatement();
|
||||
$query->delete('calendar_rooms')->executeStatement();
|
||||
$query->delete('calendar_rooms_md')->executeStatement();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class AdapterTest extends TestCase {
|
|||
->from('appconfig')
|
||||
->where($qb->expr()->eq('appid', $qb->createNamedParameter($this->appId)))
|
||||
->executeStatement();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testInsertIgnoreOnConflictDuplicate(): void {
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ class UserMountCacheTest extends TestCase {
|
|||
->where($builder->expr()->eq('fileid', new Literal($fileId)))
|
||||
->executeStatement();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
private function getStorage($storageId, $rootInternalPath = '') {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class LoaderTest extends TestCase {
|
|||
'mimetype', $deleteMimetypes->createPositionalParameter('testing/%')
|
||||
));
|
||||
$deleteMimetypes->executeStatement();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ class PreviewMigrationJobTest extends TestCase {
|
|||
$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')]
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
|||
$this->dbConn->getQueryBuilder()->delete('share')->executeStatement();
|
||||
$this->dbConn->getQueryBuilder()->delete('filecache')->runAcrossAllShards()->executeStatement();
|
||||
$this->dbConn->getQueryBuilder()->delete('storages')->executeStatement();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ class ShareByMailProviderTest extends TestCase {
|
|||
$this->dbConn->getQueryBuilder()->delete('share')->executeStatement();
|
||||
$this->dbConn->getQueryBuilder()->delete('filecache')->runAcrossAllShards()->executeStatement();
|
||||
$this->dbConn->getQueryBuilder()->delete('storages')->executeStatement();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ class SubAdminTest extends \Test\TestCase {
|
|||
->where($qb->expr()->eq('uid', $qb->createNamedParameter('orphanedUser')))
|
||||
->orWhere($qb->expr()->eq('gid', $qb->createNamedParameter('orphanedGroup')))
|
||||
->executeStatement();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testCreateSubAdmin(): void {
|
||||
|
|
|
|||
Loading…
Reference in a new issue