summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-07-06 14:50:18 +0200
committerGitHub <noreply@github.com>2018-07-06 14:50:18 +0200
commit422c805e260f3187fffe7957b2d2f637e20812e3 (patch)
tree98c007b78eabc4997b7311acc4f6599aecfcbe6f /tests
parent3c9b12139e8d6013267d6c2c48d09b0fbf527e34 (diff)
parent3d5acbb1d0944ba00fee9af72f7253e6fc7f787e (diff)
downloadnextcloud-server-422c805e260f3187fffe7957b2d2f637e20812e3.tar.gz
nextcloud-server-422c805e260f3187fffe7957b2d2f637e20812e3.zip
Merge pull request #10116 from nextcloud/lock-negative
prevent lock values from going negative with memcache backend
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Lock/LockingProvider.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/lib/Lock/LockingProvider.php b/tests/lib/Lock/LockingProvider.php
index 49742baa561..9c0461e2e60 100644
--- a/tests/lib/Lock/LockingProvider.php
+++ b/tests/lib/Lock/LockingProvider.php
@@ -243,4 +243,16 @@ abstract class LockingProvider extends TestCase {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->changeLock('foo', ILockingProvider::LOCK_SHARED);
}
+
+ public function testReleaseNonExistingShared() {
+ $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
+ $this->instance->releaseLock('foo', ILockingProvider::LOCK_SHARED);
+
+ // releasing a lock once to many should not result in a locked state
+ $this->instance->releaseLock('foo', ILockingProvider::LOCK_SHARED);
+
+ $this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
+ $this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
+ $this->instance->releaseLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
+ }
}