diff options
author | dongwenjuan <dong.wenjuan@zte.com.cn> | 2017-10-09 15:25:33 +0800 |
---|---|---|
committer | Carlos Goncalves <mail@cgoncalves.pt> | 2017-10-09 10:49:59 +0000 |
commit | 2c9569e66c4f0e333d603f93b280768bea4f2d07 (patch) | |
tree | 6459b8f961a8245fd1aaef8ba870fddf45706b1a /doctor_tests/main.py | |
parent | 5733b9ce1dcfb40e0ef6a956c0e6c092829fc6d6 (diff) |
fix to get logfile
Change-Id: I44cc6c5108eb48191ca36cbcb44f787ea542f3ce
Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
(cherry picked from commit b3dcaa337fa91b3123fa08e8b8dd2e81184a91dd)
Diffstat (limited to 'doctor_tests/main.py')
-rw-r--r-- | doctor_tests/main.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/doctor_tests/main.py b/doctor_tests/main.py index 111c93d6..b9a34430 100644 --- a/doctor_tests/main.py +++ b/doctor_tests/main.py @@ -33,7 +33,9 @@ from doctor_tests.scenario.network_failure import NetworkFault from doctor_tests.user import User -LOG = doctor_log.Logger('doctor').getLogger() +Logger = doctor_log.Logger('doctor') +LOG = Logger.getLogger() +LogFile = Logger.getLogFilename() class DoctorTest(object): @@ -106,7 +108,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.filename) + notification_time = calculate_notification_time(LogFile) if notification_time < 1 and notification_time > 0: LOG.info('doctor test successfully, notification_time=%s' % notification_time) else: @@ -156,22 +158,22 @@ class DoctorTest(object): self.fault.get_disable_network_log() def run_profiler(self): - test_dir = os.path.split(os.path.realpath(__file__))[0] + net_down_log_file = self.fault.get_disable_network_log() reg = '(?<=doctor set link down at )\d+.\d+' - linkdown = float(match_rep_in_file(reg, LOG.filename).group(0)) + linkdown = float(match_rep_in_file(reg, net_down_log_file).group(0)) reg = '(.* doctor mark vm.* error at )(\d+.\d+)' - vmdown = float(match_rep_in_file(reg, LOG.filename).group(2)) + vmdown = float(match_rep_in_file(reg, LogFile).group(2)) reg = '(.* doctor mark host.* down at )(\d+.\d+)' - hostdown = float(match_rep_in_file(reg, LOG.filename).group(2)) + hostdown = float(match_rep_in_file(reg, LogFile).group(2)) reg = '(?<=doctor monitor detected at )\d+.\d+' - detected = float(match_rep_in_file(reg, LOG.filename).group(0)) + detected = float(match_rep_in_file(reg, LogFile).group(0)) reg = '(?<=doctor consumer notified at )\d+.\d+' - notified = float(match_rep_in_file(reg, LOG.filename).group(0)) + notified = float(match_rep_in_file(reg, LogFile).group(0)) # TODO(yujunz) check the actual delay to verify time sync status # expected ~1s delay from $trigger to $linkdown |