1. [fix] DetectLinuxDistro.sh : Added code to detect Redhat distro.
2. [fix] removed hardcoded test user.
3. [fix] Fixed log collection in case of AzureVM hostname is incorrect.
4. [new] Added python RetryOperatoin.
This commit is contained in:
iamshital 2014-09-05 01:14:34 -07:00
Родитель e1e1912b43
Коммит a6112a856f
4 изменённых файлов: 32 добавлений и 13 удалений

Просмотреть файл

@ -20,6 +20,9 @@ done
if [[ "$tmp" == *CentOS* ]]; then
echo "CENTOS"
exitVal=0
elif [[ "$tmp" == *Red* ]]; then
echo "REDHAT"
exitVal=0
else
tmp=`cat /etc/system-release`
if [[ "$tmp" == *Oracle* ]]; then

Просмотреть файл

@ -31,7 +31,7 @@ if ($isDeployed)
LogMsg "Executing : $($currentTestData.testScript)"
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "./$($currentTestData.testScript)" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "mv Runtime.log $($currentTestData.testScript).log" -runAsSudo
RemoteCopy -download -downloadFrom $hs1VIP -files "/home/test/state.txt, /home/test/Summary.log, /home/test/$($currentTestData.testScript).log" -downloadTo $LogDir -port $hs1vm1sshport -username $user -password $password
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
$testStatus = Get-Content $LogDir\state.txt
LogMsg "Test result : $testResult"

Просмотреть файл

@ -18,8 +18,10 @@ Log() {
intro() {
##Create the Directory in Which Logs would be stored
currtime=$(date +"%b%d%Y-%H-%M-%S");
hostnm=$(hostname)
dirname="LIS-Logs-"${hostnm};
#hostnm=$(hostname)
hostnm=""
#dirname="LIS-Logs-"${hostnm};
dirname="LIS-Logs"
mkdir $dirname;
}

Просмотреть файл

@ -1,18 +1,8 @@
#!/usr/bin/python
#####################################################################################################################################
# THIS FILE CONTAINS ALL THE FUNCTIONS USED IN PYTHON TEST FILES... HANDLE WITH CARE...
# FOR ANY QUERY - V-SHISAV@MICROSOFT.COM
# DO NOT DELETE ANY STATEMENT FROM THE FUNCTION EVEN IF IT IS COMMENTED!!! BECAUSE I'M TRACKING, WHAT I'M DOING...
#####################################################################################################################################
import subprocess
@ -23,6 +13,10 @@ import commands
import time
import os.path
import array
#added v-sirebb
import linecache
import sys
import re
#THIS LOG WILL COLLECT ALL THE LOGS THAT ARE RUN WHILE THE TEST IS GOING ON...
RunLog = logging.getLogger("RuntimeLog : ")
@ -332,7 +326,27 @@ def RemoveICAVMsFromREVfile():
RemoveStringMatchLinesFromFile(lisvnetlab_rev_filepath,matchString)
def RetryOperation(operation, description, expectResult=None, maxRetryCount=18, retryInterval=10):
retryCount = 1
while True:
RunLog.info("Attempt : %s : %s", retryCount, description)
ret = None
try:
ret = Run(operation)
if (expectResult and (ret.strip() == expectResult)) or (expectResult == None):
return ret
except:
RunLog.info("Retrying Operation")
if retryCount >= maxRetryCount:
break
retryCount += 1
time.sleep(retryInterval)
if(expectResult != None):
return ret
return None
def AppendTextToFile(filepath,textString):
#THIS FUNCTION DONES NOT CREATES ANY FILE. THE FILE MUST PRESENT AT THE SPECIFIED LOCATION.