Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-ganeti
Commits
320b4e2d
Commit
320b4e2d
authored
Dec 03, 2007
by
Alexander Schreiber
Browse files
Fix the unittest for locking.
Reviewed-by: imsnah
parent
f4bc1f2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/ganeti.utils_unittest.py
View file @
320b4e2d
...
...
@@ -26,6 +26,7 @@ import os
import
time
import
tempfile
import
os.path
import
os
import
md5
import
socket
import
shutil
...
...
@@ -89,6 +90,21 @@ class TestIsProcessAlive(unittest.TestCase):
class
TestLocking
(
unittest
.
TestCase
):
"""Testing case for the Lock/Unlock functions"""
def
setUp
(
self
):
lock_dir
=
tempfile
.
mkdtemp
(
prefix
=
"ganeti.unittest."
,
suffix
=
".locking"
)
self
.
old_lock_dir
=
constants
.
LOCK_DIR
constants
.
LOCK_DIR
=
lock_dir
def
tearDown
(
self
):
try
:
ganeti
.
utils
.
Unlock
(
"unittest"
)
except
LockError
:
pass
shutil
.
rmtree
(
constants
.
LOCK_DIR
,
ignore_errors
=
True
)
constants
.
LOCK_DIR
=
self
.
old_lock_dir
def
clean_lock
(
self
,
name
):
try
:
ganeti
.
utils
.
Unlock
(
"unittest"
)
...
...
@@ -106,7 +122,6 @@ class TestLocking(unittest.TestCase):
ganeti
.
utils
.
Lock
(
"unittest"
)
self
.
assertEqual
(
None
,
Unlock
(
"unittest"
))
def
testDoubleLock
(
self
):
self
.
clean_lock
(
"unittest"
)
ganeti
.
utils
.
Lock
(
"unittest"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment