summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyota MIBU <r-mibu@cq.jp.nec.com>2017-10-04 16:26:33 +0000
committerRyota Mibu <r-mibu@cq.jp.nec.com>2017-10-04 16:31:08 +0000
commitf8d5647530ead1b88834e941961f5fa939c0f082 (patch)
treed2ad431a09065408cea096bedcd21e193594c003
parent94d05da570a6c2f6be987ef9af8b05c66672cf56 (diff)
fix the way to get log filename
Change-Id: I9ce494c408c99e1a76a6b485db29a72c3134e487 Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com> (cherry picked from commit 589a60fcd004ee59716273b30cea69aa7b5d102b)
-rw-r--r--doctor_tests/main.py17
-rw-r--r--doctor_tests/scenario/common.py5
2 files changed, 10 insertions, 12 deletions
diff --git a/doctor_tests/main.py b/doctor_tests/main.py
index de45510b..0ea9d36b 100644
--- a/doctor_tests/main.py
+++ b/doctor_tests/main.py
@@ -35,6 +35,9 @@ 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):
@@ -106,7 +109,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()
+ notification_time = calculate_notification_time(LOG_FILE)
if notification_time < 1 and notification_time > 0:
LOG.info('doctor test successfully, notification_time=%s' % notification_time)
else:
@@ -158,22 +161,20 @@ class DoctorTest(object):
def run_profiler(self):
test_dir = os.path.split(os.path.realpath(__file__))[0]
- log_file = '{0}/{1}'.format(test_dir, 'disable_network.log')
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_FILE).group(0))
- log_file = '{0}/{1}'.format(test_dir, 'doctor.log')
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_FILE).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_FILE).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_FILE).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_FILE).group(0))
# TODO(yujunz) check the actual delay to verify time sync status
# expected ~1s delay from $trigger to $linkdown
diff --git a/doctor_tests/scenario/common.py b/doctor_tests/scenario/common.py
index 9344dcaf..ebf0cf58 100644
--- a/doctor_tests/scenario/common.py
+++ b/doctor_tests/scenario/common.py
@@ -11,10 +11,7 @@ import os
from doctor_tests.common.utils import match_rep_in_file
-def calculate_notification_time():
- scenario_dir = os.path.split(os.path.realpath(__file__))[0]
- doctor_tests_dir = os.path.dirname(scenario_dir)
- log_file = '{0}/{1}'.format(doctor_tests_dir, 'doctor.log')
+def calculate_notification_time(log_file):
reg = '(?<=doctor monitor detected at )\d+.\d+'
result = match_rep_in_file(reg, log_file)