Module: check_mk
Branch: master
Commit: e864dff6ace99c650691a7ff3d0782dc8d8c2f6d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e864dff6ace99c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 26 11:19:45 2018 +0100
Fix issues with concurrent test jobs trying to install debian packages
Change-Id: I253dc471fc29348b36148f857697e52110cd5949
---
tests/testlib/__init__.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py
index 28ed02f..88654ad 100644
--- a/tests/testlib/__init__.py
+++ b/tests/testlib/__init__.py
@@ -196,11 +196,13 @@ class CMKVersion(object):
print("Waiting for other dpkg process to complete...\n")
time.sleep(1)
- cmd = "sudo /usr/bin/gdebi --non-interactive %s" % temp_package_path
- print(cmd)
- sys.stdout.flush()
- if os.system(cmd) >> 8 != 0:
- raise Exception("Failed to install package: %s" %
temp_package_path)
+ # Improve the protection against other test runs installing packages
+ with lockfile.FileLock("/tmp/cmk-test-install-version.lock"):
+ cmd = "sudo /usr/bin/gdebi --non-interactive %s" %
temp_package_path
+ print(cmd)
+ sys.stdout.flush()
+ if os.system(cmd) >> 8 != 0:
+ raise Exception("Failed to install package: %s" %
temp_package_path)
os.unlink(temp_package_path)