Skip to content

Commit

Permalink
test(timeout): locks are deprecated after expiry
Browse files Browse the repository at this point in the history
Signed-off-by: Max <max@nextcloud.com>

[skip ci]
  • Loading branch information
max-nextcloud authored and backportbot[bot] committed Feb 13, 2025
1 parent 7cec8e4 commit e54564d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Feature/LockFeatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use OC\Files\Lock\LockManager;
use OCA\FilesLock\AppInfo\Application;
use OCA\FilesLock\Service\ConfigService;
use OCA\FilesLock\Service\LockService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\IRootFolder;
use OCP\Files\Lock\ILock;
Expand Down Expand Up @@ -195,6 +196,16 @@ public function testLockUserExpire() {
self::assertEquals('CCC', $file->getContent());
}

public function testExpiredLocksAreDeprecated() {
\OCP\Server::get(IConfig::class)->setAppValue(Application::APP_ID, ConfigService::LOCK_TIMEOUT, 30);
$file = $this->loginAndGetUserFolder(self::TEST_USER1)
->newFile('test-expired-lock-is-deprecated', 'AAA');
$this->lockManager->lock(new LockContext($file, ILock::TYPE_USER, self::TEST_USER1));
$this->toTheFuture(3600);
$deprecated = \OCP\Server::get(LockService::class)->getDeprecatedLocks();
self::assertNotEmpty($deprecated);
}

public function testLockUserInfinite() {
\OC::$server->getConfig()->setAppValue(Application::APP_ID, ConfigService::LOCK_TIMEOUT, 0);
$file = $this->loginAndGetUserFolder(self::TEST_USER1)
Expand Down

0 comments on commit e54564d

Please sign in to comment.