diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-04-14 13:17:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-14 13:17:16 +0200 |
commit | ea3a9ba86eba31bc127ea91fa706546d991f4984 (patch) | |
tree | b01d2f800a52e3883adb9314104ccc5c3f7bbac6 /apps | |
parent | 69262f83a7f7a9b3e82526b22e869eb71eb70d08 (diff) | |
parent | b05c9fe369643677c242e7e8362c005b52c516cc (diff) | |
download | nextcloud-server-ea3a9ba86eba31bc127ea91fa706546d991f4984.tar.gz nextcloud-server-ea3a9ba86eba31bc127ea91fa706546d991f4984.zip |
Merge pull request #31453 from nextcloud/s3-primary-ci-23
[stable23] Run tests with primary object storage in CI + large upload fixes
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/File.php | 18 | ||||
-rw-r--r-- | apps/files_sharing/tests/CacheTest.php | 8 | ||||
-rw-r--r-- | apps/files_trashbin/tests/StorageTest.php | 4 |
3 files changed, 24 insertions, 6 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index bf7e469a0c0..963a07a55fb 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -184,7 +184,23 @@ class File extends Node implements IFile { [$storage, $internalPath] = $this->fileView->resolvePath($this->path); try { if (!$needsPartFile) { - $this->changeLock(ILockingProvider::LOCK_EXCLUSIVE); + try { + $this->changeLock(ILockingProvider::LOCK_EXCLUSIVE); + } catch (LockedException $e) { + // during very large uploads, the shared lock we got at the start might have been expired + // meaning that the above lock can fail not just only because somebody else got a shared lock + // or because there is no existing shared lock to make exclusive + // + // Thus we try to get a new exclusive lock, if the original lock failed because of a different shared + // lock this will still fail, if our original shared lock expired the new lock will be successful and + // the entire operation will be safe + + try { + $this->acquireLock(ILockingProvider::LOCK_EXCLUSIVE); + } catch (LockedException $ex) { + throw new FileLocked($e->getMessage(), $e->getCode(), $e); + } + } } if (!is_resource($data)) { diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 2623b4c34b5..f4f64bc6a32 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -243,6 +243,9 @@ class CacheTest extends TestCase { public function testGetFolderContentsInRoot() { $results = $this->user2View->getDirectoryContent('/'); + $results = (array_filter($results, function($file) { + return $file->getName() !== 'welcome.txt'; + })); // we should get the shared items "shareddir" and "shared single file.txt" // additional root will always contain the example file "welcome.txt", @@ -250,11 +253,6 @@ class CacheTest extends TestCase { $this->verifyFiles( [ [ - 'name' => 'welcome.txt', - 'path' => 'files/welcome.txt', - 'mimetype' => 'text/plain', - ], - [ 'name' => 'shareddir', 'path' => 'files/shareddir', 'mimetype' => 'httpd/unix-directory', diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php index 448c3a6adb1..0a7a129ca28 100644 --- a/apps/files_trashbin/tests/StorageTest.php +++ b/apps/files_trashbin/tests/StorageTest.php @@ -33,6 +33,7 @@ namespace OCA\Files_Trashbin\Tests; use OC\Files\Filesystem; use OC\Files\Storage\Common; +use OC\Files\Storage\Local; use OC\Files\Storage\Temporary; use OCA\Files_Trashbin\AppInfo\Application; use OCA\Files_Trashbin\Events\MoveToTrashEvent; @@ -661,6 +662,9 @@ class StorageTest extends \Test\TestCase { } public function testMoveFromStoragePreserveFileId() { + if (!$this->userView->getMount('')->getStorage()->instanceOfStorage(Local::class)) { + $this->markTestSkipped("Skipping on non-local users storage"); + } $this->userView->file_put_contents('test.txt', 'foo'); $fileId = $this->userView->getFileInfo('test.txt')->getId(); |