mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 02:00:20 +00:00
Updated tests to release lock with try/except/finally
This commit is contained in:
parent
8fb0127f99
commit
6a2fb70d59
1 changed files with 7 additions and 2 deletions
|
@ -460,7 +460,8 @@ def test_git_provider_mp_lock_dead_pid(main_class, caplog):
|
|||
"Failed to write fake dead pid lock file %s, exception %s", file_name, exc
|
||||
)
|
||||
|
||||
provider._master_lock.release()
|
||||
finally:
|
||||
provider._master_lock.release()
|
||||
|
||||
caplog.clear()
|
||||
with caplog.at_level(logging.DEBUG):
|
||||
|
@ -528,7 +529,8 @@ def test_git_provider_mp_lock_bad_machine(main_class, caplog):
|
|||
"Failed to write fake dead pid lock file %s, exception %s", file_name, exc
|
||||
)
|
||||
|
||||
provider._master_lock.release()
|
||||
finally:
|
||||
provider._master_lock.release()
|
||||
|
||||
caplog.clear()
|
||||
with caplog.at_level(logging.DEBUG):
|
||||
|
@ -563,6 +565,8 @@ class KillProcessTest(salt.utils.process.SignalHandlingProcess):
|
|||
Start the test process to kill
|
||||
"""
|
||||
self.provider.lock()
|
||||
lockfile = self.provider._get_lock_file()
|
||||
log.debug("KillProcessTest acquried lock file %s", lockfile)
|
||||
|
||||
# check that lock has been released
|
||||
assert self.provider._master_lock.acquire(timeout=5)
|
||||
|
@ -574,6 +578,7 @@ class KillProcessTest(salt.utils.process.SignalHandlingProcess):
|
|||
|
||||
@pytest.mark.slow_test
|
||||
@pytest.mark.skip_unless_on_linux
|
||||
@pytest.mark.timeout_unless_on_windows(120)
|
||||
def test_git_provider_sigterm_cleanup(main_class):
|
||||
"""
|
||||
Start process which will obtain lock, and leave it locked
|
||||
|
|
Loading…
Add table
Reference in a new issue