Module: check_mk
Branch: master
Commit: 5053f07077b95ec3bd76b65db9d47566452df0b1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5053f07077b95e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 8 11:38:53 2016 +0100
Added test for precompiled update agent
---
.../windows/test_precompiled_cmk_update_agent.py | 38 ++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/tests/agents/windows/test_precompiled_cmk_update_agent.py
b/tests/agents/windows/test_precompiled_cmk_update_agent.py
new file mode 100644
index 0000000..b3a2b5d
--- /dev/null
+++ b/tests/agents/windows/test_precompiled_cmk_update_agent.py
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+# encoding: utf-8
+
+import os
+import glob
+from testlib import cmc_path
+
+precompiled_files = [
+ 'plugins/cmk-update-agent.exe'
+]
+
+
+def test_precompiled_files_present():
+ for filename in precompiled_files:
+ path = "%s/agents/windows/%s" % (cmc_path(), filename)
+ assert os.path.exists(path)
+
+
+def test_precompiled_file_ages():
+ newest_source_file, newest_source_time = find_newest_source_file()
+
+ for filename in precompiled_files:
+ path = "%s/agents/windows/%s" % (cmc_path(), filename)
+ commit_time = last_commit_time(path)
+ assert commit_time >= newest_source_time, \
+ "%s is older than source code file %s" % (path,
newest_source_file)
+
+
+def find_newest_source_file():
+ path = "%s/agents/plugins/cmk-update-agent" % cmc_path()
+ return path, last_commit_time(path)
+
+
+def last_commit_time(path):
+ lines = os.popen('unset GIT_DIR ; cd "%s" ; '
+ 'git log -n 1 --date=raw -- "%s"' % (os.path.dirname(path),
path)).readlines()
+ timestamp = int(lines[2].split()[1])
+ return timestamp