[asterisk-commits] Testsuite/ARI: Added a pluggable module for log validation. (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 29 09:20:50 CDT 2015
Matt Jordan has submitted this change and it was merged.
Change subject: Testsuite/ARI: Added a pluggable module for log validation.
......................................................................
Testsuite/ARI: Added a pluggable module for log validation.
This pluggable module is used to verify a log files existence. It
will look inside the current test's log directory and check to see
if the given file is present or not. Another option, pass-if-present,
can be set to True or False based on what we expect the test to do.
* Added log validation pluggable module
* Log files can be verified in the testuite
ASTERISK-25252
Change-Id: I3bf8e63071e579552838e814aeda0ba5d6bb6180
---
M lib/python/asterisk/pluggable_modules.py
1 file changed, 28 insertions(+), 0 deletions(-)
Approvals:
Matt Jordan: Looks good to me, approved; Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/lib/python/asterisk/pluggable_modules.py b/lib/python/asterisk/pluggable_modules.py
index b1be1f8..66e5ec8 100755
--- a/lib/python/asterisk/pluggable_modules.py
+++ b/lib/python/asterisk/pluggable_modules.py
@@ -812,6 +812,34 @@
PLUGGABLE_ACTION_REGISTRY.register("logger", LogActionModule)
+class ValidateLogActionModule(object):
+ """An action module that validates a log files existence."""
+
+ def __init__(self, test_object, config):
+ self.test_object = test_object
+ self.logfile = config["logfile"]
+ self.pass_if_present = config["pass-if-present"]
+
+ def run(self, triggered_by, source, extra):
+ """Check to see if log file is present or not."""
+ files = []
+ testpath = ('%s/var/log/asterisk' %
+ (self.test_object.ast[0].base))
+ for (dirpath, dirnames, filenames) in os.walk(testpath):
+ files.extend(filenames)
+ break
+ if self.logfile in files:
+ if (self.pass_if_present):
+ self.test_object.set_passed(True)
+ else:
+ self.test_object.set_passed(False)
+ else:
+ if (self.pass_if_present):
+ self.test_object.set_passed(False)
+ else:
+ self.test_object.set_passed(True)
+PLUGGABLE_ACTION_REGISTRY.register("validate-log", ValidateLogActionModule)
+
class CallbackActionModule(object):
"""An action module that calls the specified callback."""
--
To view, visit https://gerrit.asterisk.org/978
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3bf8e63071e579552838e814aeda0ba5d6bb6180
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list