summaryrefslogtreecommitdiffstats
path: root/doctor_tests
diff options
context:
space:
mode:
authorCarlos Goncalves <mail@cgoncalves.pt>2017-10-06 18:54:22 +0200
committerCarlos Goncalves <mail@cgoncalves.pt>2017-10-06 18:54:22 +0200
commit4f6132978ad548ee1e696016d450d0b4a4cbab9f (patch)
tree2b8959606a40fe1677cb930286fed7a4c60f6ae6 /doctor_tests
parent171f4b42c7d6e179a987b98b46d8c9ae6f2fc36d (diff)
Fix retrieval of log filename path
Change-Id: I0dd61a020827e7ba9ec7a2e0300bf50dd7175e86 Signed-off-by: Carlos Goncalves <mail@cgoncalves.pt>
Diffstat (limited to 'doctor_tests')
-rw-r--r--doctor_tests/logger.py1
-rw-r--r--doctor_tests/main.py15
2 files changed, 7 insertions, 9 deletions
diff --git a/doctor_tests/logger.py b/doctor_tests/logger.py
index b7a49fdb..2da2c0de 100644
--- a/doctor_tests/logger.py
+++ b/doctor_tests/logger.py
@@ -40,6 +40,7 @@ class Logger(object):
file_handler = logging.FileHandler(filename, mode='w')
file_handler.setFormatter(formatter)
file_handler.setLevel(logging.DEBUG)
+ self.filename = file_handler.baseFilename
self.logger.addHandler(file_handler)
def getLogger(self):
diff --git a/doctor_tests/main.py b/doctor_tests/main.py
index 0ea9d36b..111c93d6 100644
--- a/doctor_tests/main.py
+++ b/doctor_tests/main.py
@@ -35,9 +35,6 @@ from doctor_tests.user import User
LOG = doctor_log.Logger('doctor').getLogger()
-# TODO (r-mibu): fix doctor logger or consider logfile option
-LOG_FILE = LOG.handlers[0].baseFilename
-
class DoctorTest(object):
@@ -109,7 +106,7 @@ class DoctorTest(object):
# NOTE (umar) copy remote monitor.log file when monitor=collectd
self.check_host_status(self.down_host.name, 'down')
- notification_time = calculate_notification_time(LOG_FILE)
+ notification_time = calculate_notification_time(LOG.filename)
if notification_time < 1 and notification_time > 0:
LOG.info('doctor test successfully, notification_time=%s' % notification_time)
else:
@@ -162,19 +159,19 @@ class DoctorTest(object):
test_dir = os.path.split(os.path.realpath(__file__))[0]
reg = '(?<=doctor set link down at )\d+.\d+'
- linkdown = float(match_rep_in_file(reg, LOG_FILE).group(0))
+ linkdown = float(match_rep_in_file(reg, LOG.filename).group(0))
reg = '(.* doctor mark vm.* error at )(\d+.\d+)'
- vmdown = float(match_rep_in_file(reg, LOG_FILE).group(2))
+ vmdown = float(match_rep_in_file(reg, LOG.filename).group(2))
reg = '(.* doctor mark host.* down at )(\d+.\d+)'
- hostdown = float(match_rep_in_file(reg, LOG_FILE).group(2))
+ hostdown = float(match_rep_in_file(reg, LOG.filename).group(2))
reg = '(?<=doctor monitor detected at )\d+.\d+'
- detected = float(match_rep_in_file(reg, LOG_FILE).group(0))
+ detected = float(match_rep_in_file(reg, LOG.filename).group(0))
reg = '(?<=doctor consumer notified at )\d+.\d+'
- notified = float(match_rep_in_file(reg, LOG_FILE).group(0))
+ notified = float(match_rep_in_file(reg, LOG.filename).group(0))
# TODO(yujunz) check the actual delay to verify time sync status
# expected ~1s delay from $trigger to $linkdown