|
@@ 1327-1352 (lines=26) @@
|
| 1324 |
|
/** |
| 1325 |
|
* Test that locks are on mount point paths instead of mount root |
| 1326 |
|
*/ |
| 1327 |
|
public function testLockLocalMountPointPathInsteadOfStorageRoot() { |
| 1328 |
|
$lockingProvider = \OC::$server->getLockingProvider(); |
| 1329 |
|
$view = new \OC\Files\View('/testuser/files/'); |
| 1330 |
|
$storage = new Temporary([]); |
| 1331 |
|
\OC\Files\Filesystem::mount($storage, [], '/'); |
| 1332 |
|
$mountedStorage = new Temporary([]); |
| 1333 |
|
\OC\Files\Filesystem::mount($mountedStorage, [], '/testuser/files/mountpoint'); |
| 1334 |
|
|
| 1335 |
|
$this->assertTrue( |
| 1336 |
|
$view->lockFile('/mountpoint', ILockingProvider::LOCK_EXCLUSIVE, true), |
| 1337 |
|
'Can lock mount point' |
| 1338 |
|
); |
| 1339 |
|
|
| 1340 |
|
// no exception here because storage root was not locked |
| 1341 |
|
$mountedStorage->acquireLock('', ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider); |
| 1342 |
|
|
| 1343 |
|
$thrown = false; |
| 1344 |
|
try { |
| 1345 |
|
$storage->acquireLock('/testuser/files/mountpoint', ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider); |
| 1346 |
|
} catch (\OCP\Lock\LockedException $e) { |
| 1347 |
|
$thrown = true; |
| 1348 |
|
} |
| 1349 |
|
$this->assertTrue($thrown, 'Mount point path was locked on root storage'); |
| 1350 |
|
|
| 1351 |
|
$lockingProvider->releaseAll(); |
| 1352 |
|
} |
| 1353 |
|
|
| 1354 |
|
/** |
| 1355 |
|
* Test that locks are on mount point paths and also mount root when requested |
|
@@ 1357-1382 (lines=26) @@
|
| 1354 |
|
/** |
| 1355 |
|
* Test that locks are on mount point paths and also mount root when requested |
| 1356 |
|
*/ |
| 1357 |
|
public function testLockStorageRootButNotLocalMountPoint() { |
| 1358 |
|
$lockingProvider = \OC::$server->getLockingProvider(); |
| 1359 |
|
$view = new \OC\Files\View('/testuser/files/'); |
| 1360 |
|
$storage = new Temporary([]); |
| 1361 |
|
\OC\Files\Filesystem::mount($storage, [], '/'); |
| 1362 |
|
$mountedStorage = new Temporary([]); |
| 1363 |
|
\OC\Files\Filesystem::mount($mountedStorage, [], '/testuser/files/mountpoint'); |
| 1364 |
|
|
| 1365 |
|
$this->assertTrue( |
| 1366 |
|
$view->lockFile('/mountpoint', ILockingProvider::LOCK_EXCLUSIVE, false), |
| 1367 |
|
'Can lock mount point' |
| 1368 |
|
); |
| 1369 |
|
|
| 1370 |
|
$thrown = false; |
| 1371 |
|
try { |
| 1372 |
|
$mountedStorage->acquireLock('', ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider); |
| 1373 |
|
} catch (\OCP\Lock\LockedException $e) { |
| 1374 |
|
$thrown = true; |
| 1375 |
|
} |
| 1376 |
|
$this->assertTrue($thrown, 'Mount point storage root was locked on original storage'); |
| 1377 |
|
|
| 1378 |
|
// local mount point was not locked |
| 1379 |
|
$storage->acquireLock('/testuser/files/mountpoint', ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider); |
| 1380 |
|
|
| 1381 |
|
$lockingProvider->releaseAll(); |
| 1382 |
|
} |
| 1383 |
|
|
| 1384 |
|
/** |
| 1385 |
|
* Test that locks are on mount point paths and also mount root when requested |