Ejegg has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/342969 )

Change subject: test failopen; py2
......................................................................


test failopen; py2

Change-Id: Id33866f7887aa404f453cf5ced6307fd83e2c2fd
---
M tests/test_lock.py
1 file changed, 14 insertions(+), 0 deletions(-)

Approvals:
  Ejegg: Verified; Looks good to me, approved



diff --git a/tests/test_lock.py b/tests/test_lock.py
index cc3d71b..54f1227 100644
--- a/tests/test_lock.py
+++ b/tests/test_lock.py
@@ -52,6 +52,20 @@
     lock.end()
 
 
+@nose.tools.raises(lock.LockError)
+def test_stale_lock_failopen():
+    tag = "stale-open"
+    lock.begin(job_tag=tag, failopen=True)
+
+    # Make the lockfile stale by changing the process ID.
+    assert lock.lockfile
+    f = open(lock.lockfile, "w")
+    f.write("-1")
+    f.close()
+
+    lock.begin(job_tag=tag)
+
+
 def test_invalid_lock():
     tag = "stale"
     lock.begin(job_tag=tag)

-- 
To view, visit https://gerrit.wikimedia.org/r/342969
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id33866f7887aa404f453cf5ced6307fd83e2c2fd
Gerrit-PatchSet: 3
Gerrit-Project: wikimedia/fundraising/process-control
Gerrit-Branch: master
Gerrit-Owner: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to