add ignorable errors in wala log
This commit is contained in:
Родитель
1389fae13b
Коммит
2acac8201a
|
@ -2548,7 +2548,7 @@
|
|||
<testName>BVT-VERIFY-NO-ERROR-IN-LOGS</testName>
|
||||
<testScript>BVT-VERIFY-NO-ERROR-IN-LOGS.py</testScript>
|
||||
<testScriptPs1>BVT-VERIFY-NO-ERROR-IN-LOGS.ps1</testScriptPs1>
|
||||
<files>.\remote-scripts\azuremodules.py,.\remote-scripts\BVT-VERIFY-NO-ERROR-IN-LOGS.py</files>
|
||||
<files>.\remote-scripts\azuremodules.py,.\remote-scripts\BVT-VERIFY-NO-ERROR-IN-LOGS.py,.\remote-scripts\ignorable-walalog-errors.xml</files>
|
||||
<setupType>BVTDeployment</setupType>
|
||||
<TestType></TestType>
|
||||
<TestFeature></TestFeature>
|
||||
|
|
|
@ -19,7 +19,7 @@ if ($isDeployed)
|
|||
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "chmod +x *" -runAsSudo
|
||||
|
||||
LogMsg "Executing : $($currentTestData.testScript)"
|
||||
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "$python_cmd $($currentTestData.testScript)" -runAsSudo
|
||||
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "$python_cmd $($currentTestData.testScript) -wl ignorable-walalog-errors.xml" -runAsSudo
|
||||
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "mv Runtime.log $($currentTestData.testScript).log" -runAsSudo
|
||||
RemoteCopy -download -downloadFrom $hs1VIP -files "/home/$user/state.txt, /home/$user/Summary.log, /home/$user/$($currentTestData.testScript).log" -downloadTo $LogDir -port $hs1vm1sshport -username $user -password $password
|
||||
$testResult = Get-Content $LogDir\Summary.log
|
||||
|
|
|
@ -4,25 +4,56 @@ from azuremodules import *
|
|||
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
|
||||
expectedValue = "0"
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-wl', '--whitelist', help='specify the xml file which contains the ignorable errors')
|
||||
|
||||
def RunTest(expectedvalue):
|
||||
args = parser.parse_args()
|
||||
white_list_xml = args.whitelist
|
||||
|
||||
def RunTest():
|
||||
UpdateState("TestRunning")
|
||||
RunLog.info("Checking log waagent.log...")
|
||||
temp = Run("grep -i error /var/log/waagent.log | grep -v health | wc -l | tr -d '\n'")
|
||||
output = temp
|
||||
if (expectedvalue == output) :
|
||||
RunLog.info("Checking for ERROR messages in waagent.log...")
|
||||
errors = Run("grep -i error /var/log/waagent.log")
|
||||
if (not errors) :
|
||||
RunLog.info('There is no errors in the logs waagent.log')
|
||||
ResultLog.info('PASS')
|
||||
UpdateState("TestCompleted")
|
||||
else :
|
||||
RunLog.error('Verify log waagent.log fail. Current value : %s Expected value : %s' % (output, expectedvalue))
|
||||
errorInfo = Run("grep -i error /var/log/waagent.log")
|
||||
RunLog.error('error Info from waagent.log as below: \n' + errorInfo)
|
||||
ResultLog.error('FAIL')
|
||||
UpdateState("TestCompleted")
|
||||
if white_list_xml and os.path.isfile(white_list_xml):
|
||||
try:
|
||||
import xml.etree.cElementTree as ET
|
||||
except ImportError:
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
RunTest(expectedValue)
|
||||
white_list_file = ET.parse(white_list_xml)
|
||||
xml_root = white_list_file.getroot()
|
||||
RunLog.info('Checking ignorable walalog ERROR messages...')
|
||||
for node in xml_root:
|
||||
if (errors and node.tag == "errors"):
|
||||
errors = RemoveIgnorableMessages(errors, node)
|
||||
if (errors):
|
||||
RunLog.info('ERROR are present in wala log.')
|
||||
RunLog.info('Errors: ' + ''.join(errors))
|
||||
ResultLog.error('FAIL')
|
||||
else:
|
||||
ResultLog.info('PASS')
|
||||
UpdateState("TestCompleted")
|
||||
|
||||
def RemoveIgnorableMessages(messages, keywords_xml_node):
|
||||
message_list = messages.strip().split('\n')
|
||||
valid_list = []
|
||||
for msg in message_list:
|
||||
for keywords in keywords_xml_node:
|
||||
if keywords.text in msg:
|
||||
RunLog.info('Ignorable ERROR message: ' + msg)
|
||||
break
|
||||
else:
|
||||
valid_list.append(msg)
|
||||
if len(valid_list) > 0:
|
||||
return valid_list
|
||||
else:
|
||||
return None
|
||||
|
||||
RunTest()
|
|
@ -0,0 +1,8 @@
|
|||
<!--#This list contains the ignorable boot errors of different images.-->
|
||||
<messages>
|
||||
<errors>
|
||||
<keywords>Error Code is 127</keywords>
|
||||
<keywords>parted</keywords>
|
||||
<keywords>Failed to config rdma device</keywords>
|
||||
</errors>
|
||||
</messages>
|
Загрузка…
Ссылка в новой задаче