Add new TC: BVT-VERIFY-BASH-HISTORY
This commit is contained in:
Родитель
dc05cf969e
Коммит
b37515a076
|
@ -2577,6 +2577,17 @@
|
|||
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
|
||||
<TestID>AzureBVT_026</TestID>
|
||||
</test>
|
||||
<test>
|
||||
<testName>BVT-VERIFY-BASH-HISTORY</testName>
|
||||
<testScript>BVT-VERIFY-BASH-HISTORY.py</testScript>
|
||||
<testScriptPs1>BVT-VERIFY-BASH-HISTORY.ps1</testScriptPs1>
|
||||
<files>.\remote-scripts\azuremodules.py,.\remote-scripts\BVT-VERIFY-BASH-HISTORY.py</files>
|
||||
<setupType>BVTDeployment</setupType>
|
||||
<TestType></TestType>
|
||||
<TestFeature></TestFeature>
|
||||
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
|
||||
<TestID>AzureBVT_027</TestID>
|
||||
</test>
|
||||
|
||||
<test>
|
||||
<testName>NETWORK-OUTBOUND-ACCESS-IPERF-DTAP-UDP</testName>
|
||||
|
@ -4139,6 +4150,9 @@
|
|||
<test>
|
||||
<Name>BVT-VERIFY-RHUI-DOWNLOAD</Name>
|
||||
</test>
|
||||
<test>
|
||||
<Name>BVT-VERIFY-BASH-HISTORY</Name>
|
||||
</test>
|
||||
<test>
|
||||
<Name>BVT-VERIFY-VHD-PREREQUISITES</Name>
|
||||
</test>
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<#-------------Create Deployment Start------------------#>
|
||||
Import-Module .\TestLibs\RDFELibs.psm1 -Force
|
||||
$result = ""
|
||||
$testResult = ""
|
||||
$resultArr = @()
|
||||
|
||||
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
|
||||
if ($isDeployed)
|
||||
{
|
||||
try
|
||||
{
|
||||
$hs1VIP = $AllVMData.PublicIP
|
||||
$hs1vm1sshport = $AllVMData.SSHPort
|
||||
$hs1ServiceUrl = $AllVMData.URL
|
||||
$hs1vm1Dip = $AllVMData.InternalIP
|
||||
$hs1vm1Hostname = $AllVMData.RoleName
|
||||
|
||||
RemoteCopy -uploadTo $hs1VIP -port $hs1vm1sshport -files $currentTestData.files -username $user -password $password -upload
|
||||
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 "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
|
||||
$testStatus = Get-Content $LogDir\state.txt
|
||||
LogMsg "Test result : $testResult"
|
||||
|
||||
if ($testStatus -eq "TestCompleted")
|
||||
{
|
||||
LogMsg "Test Completed"
|
||||
}
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
$ErrorMessage = $_.Exception.Message
|
||||
LogMsg "EXCEPTION : $ErrorMessage"
|
||||
}
|
||||
Finally
|
||||
{
|
||||
$metaData = ""
|
||||
if (!$testResult)
|
||||
{
|
||||
$testResult = "Aborted"
|
||||
}
|
||||
$resultArr += $testResult
|
||||
#$resultSummary += CreateResultSummary -testResult $testResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName# if you want to publish all result then give here all test status possibilites. if you want just failed results, then give here just "FAIL". You can use any combination of PASS FAIL ABORTED and corresponding test results will be published!
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$testResult = "Aborted"
|
||||
$resultArr += $testResult
|
||||
}
|
||||
|
||||
$result = GetFinalResultHeader -resultarr $resultArr
|
||||
|
||||
#Clean up the setup
|
||||
DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
|
||||
|
||||
#Return the result and summery to the test suite script..
|
||||
return $result
|
|
@ -0,0 +1,32 @@
|
|||
#! /usr/bin/env python
|
||||
from azuremodules import *
|
||||
import os
|
||||
import os.path
|
||||
|
||||
root_bash_hist_file = '/root/.bash_history'
|
||||
root_bash_hist_file_default = '/root/default_bash_history'
|
||||
|
||||
def RunTest():
|
||||
UpdateState("TestRunning")
|
||||
if os.path.exists(root_bash_hist_file_default):
|
||||
RunLog.info("This is a prepared image, check the copied default history file: %s" % root_bash_hist_file_default)
|
||||
result = IsBashHistFileEmpty(root_bash_hist_file_default)
|
||||
elif os.path.exists(root_bash_hist_file):
|
||||
RunLog.info("This is a unprepared image, check the original history file: %s" % root_bash_hist_file)
|
||||
result = IsBashHistFileEmpty(root_bash_hist_file)
|
||||
else:
|
||||
RunLog.info("No bash history file exists.")
|
||||
result = True
|
||||
|
||||
if result:
|
||||
ResultLog.info('PASS')
|
||||
RunLog.info("Empty, as expected.")
|
||||
else:
|
||||
ResultLog.error('FAIL')
|
||||
RunLog.error("Not empty, non-expected.")
|
||||
UpdateState("TestCompleted")
|
||||
|
||||
def IsBashHistFileEmpty(file):
|
||||
return os.stat(file).st_size == 0
|
||||
|
||||
RunTest()
|
|
@ -24,7 +24,7 @@ if ($isDeployed)
|
|||
$hs1ServiceUrl = $hs1ServiceUrl.Replace("/","")
|
||||
$hs1vm1Hostname = $hs1vm1.Name
|
||||
|
||||
|
||||
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "cp /root/.bash_history /root/default_bash_history" -runAsSudo -ignoreLinuxExitCode
|
||||
RemoteCopy -uploadTo $hs1VIP -port $hs1vm1sshport -files $currentTestData.files -username $user -password $password -upload -doNotCompress
|
||||
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "chmod +x *" -runAsSudo
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче