|
@@ 1304-1329 (lines=26) @@
|
| 1301 |
|
/** |
| 1302 |
|
* Test that locks are on mount point paths instead of mount root |
| 1303 |
|
*/ |
| 1304 |
|
public function testLockLocalMountPointPathInsteadOfStorageRoot() { |
| 1305 |
|
$lockingProvider = \OC::$server->getLockingProvider(); |
| 1306 |
|
$view = new \OC\Files\View('/testuser/files/'); |
| 1307 |
|
$storage = new Temporary([]); |
| 1308 |
|
\OC\Files\Filesystem::mount($storage, [], '/'); |
| 1309 |
|
$mountedStorage = new Temporary([]); |
| 1310 |
|
\OC\Files\Filesystem::mount($mountedStorage, [], '/testuser/files/mountpoint'); |
| 1311 |
|
|
| 1312 |
|
$this->assertTrue( |
| 1313 |
|
$view->lockFile('/mountpoint', ILockingProvider::LOCK_EXCLUSIVE, true), |
| 1314 |
|
'Can lock mount point' |
| 1315 |
|
); |
| 1316 |
|
|
| 1317 |
|
// no exception here because storage root was not locked |
| 1318 |
|
$mountedStorage->acquireLock('', ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider); |
| 1319 |
|
|
| 1320 |
|
$thrown = false; |
| 1321 |
|
try { |
| 1322 |
|
$storage->acquireLock('/testuser/files/mountpoint', ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider); |
| 1323 |
|
} catch (\OCP\Lock\LockedException $e) { |
| 1324 |
|
$thrown = true; |
| 1325 |
|
} |
| 1326 |
|
$this->assertTrue($thrown, 'Mount point path was locked on root storage'); |
| 1327 |
|
|
| 1328 |
|
$lockingProvider->releaseAll(); |
| 1329 |
|
} |
| 1330 |
|
|
| 1331 |
|
/** |
| 1332 |
|
* Test that locks are on mount point paths and also mount root when requested |
|
@@ 1334-1359 (lines=26) @@
|
| 1331 |
|
/** |
| 1332 |
|
* Test that locks are on mount point paths and also mount root when requested |
| 1333 |
|
*/ |
| 1334 |
|
public function testLockStorageRootButNotLocalMountPoint() { |
| 1335 |
|
$lockingProvider = \OC::$server->getLockingProvider(); |
| 1336 |
|
$view = new \OC\Files\View('/testuser/files/'); |
| 1337 |
|
$storage = new Temporary([]); |
| 1338 |
|
\OC\Files\Filesystem::mount($storage, [], '/'); |
| 1339 |
|
$mountedStorage = new Temporary([]); |
| 1340 |
|
\OC\Files\Filesystem::mount($mountedStorage, [], '/testuser/files/mountpoint'); |
| 1341 |
|
|
| 1342 |
|
$this->assertTrue( |
| 1343 |
|
$view->lockFile('/mountpoint', ILockingProvider::LOCK_EXCLUSIVE, false), |
| 1344 |
|
'Can lock mount point' |
| 1345 |
|
); |
| 1346 |
|
|
| 1347 |
|
$thrown = false; |
| 1348 |
|
try { |
| 1349 |
|
$mountedStorage->acquireLock('', ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider); |
| 1350 |
|
} catch (\OCP\Lock\LockedException $e) { |
| 1351 |
|
$thrown = true; |
| 1352 |
|
} |
| 1353 |
|
$this->assertTrue($thrown, 'Mount point storage root was locked on original storage'); |
| 1354 |
|
|
| 1355 |
|
// local mount point was not locked |
| 1356 |
|
$storage->acquireLock('/testuser/files/mountpoint', ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider); |
| 1357 |
|
|
| 1358 |
|
$lockingProvider->releaseAll(); |
| 1359 |
|
} |
| 1360 |
|
|
| 1361 |
|
/** |
| 1362 |
|
* Test that locks are on mount point paths and also mount root when requested |