First capture the VHD and then run all the BVT tests. Finally delete the
captured VHD along with the RG.
This commit is contained in:
ChandraKamarapu 2017-07-07 11:34:34 +05:30
Родитель bb64eca40a
Коммит 1b5804f5c7
3 изменённых файлов: 119 добавлений и 1 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -4,4 +4,5 @@ tools*
report*
report/AdditionalInfo.html
Azure_ICA_all_*
temp*
temp*
.vscode

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

@ -4849,6 +4849,32 @@
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<TestID>AzureBVT_029</TestID>
</test>
<test>
<testName>BVT-CAPTURE-VHD</testName>
<testScript></testScript>
<testScriptPs1>BVT-CAPTURE-VHD.ps1</testScriptPs1>
<files></files>
<setupType>BVTDeployment</setupType>
<TestType>
</TestType>
<TestFeature>
</TestFeature>
<SupportedExecutionModes>AzureResourceManager</SupportedExecutionModes>
<TestID>AzureBVT_000</TestID>
</test>
<test>
<testName>BVT-DELETE-VHD</testName>
<testScript></testScript>
<testScriptPs1>BVT-CAPTURE-VHD.ps1</testScriptPs1>
<files></files>
<setupType>BVTDeployment</setupType>
<TestType>
</TestType>
<TestFeature>
</TestFeature>
<SupportedExecutionModes>AzureResourceManager</SupportedExecutionModes>
<TestID>AzureBVT_100</TestID>
</test>
<test>
<testName>ICA-VERIFY-RDMA</testName>
<testScript>ICA-VERIFY-RDMA.py</testScript>
@ -7117,6 +7143,10 @@
<!-- BVT tests -->
<Cycle>
<cycleName>BVT</cycleName>
<!-- Do not delete BVT-CAPTURE-VHD test. This should always be the first test -->
<test>
<Name>BVT-CAPTURE-VHD</Name>
</test>
<test>
<Name>BVT-VERIFY-NO-ERROR-IN-LOGS</Name>
</test>
@ -7192,6 +7222,10 @@
<test>
<Name>BVT-VERIFY-SHUTDOWN</Name>
</test>
<!-- Do not delete BVT-DELETE-VHD test. This should always be the last test -->
<test>
<Name>BVT-DELETE-VHD</Name>
</test>
</Cycle>
<!-- Network Outbound Access tests -->

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

@ -0,0 +1,83 @@
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
try {
if($testId.ToUpper() -eq "AZUREBVT_000" -and ($customKernel -or $customLIS))
{
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
foreach ($VM in $allVMData)
{
$ResourceGroupUnderTest = $VM.ResourceGroupName
Set-Variable -Name ResourceGroupUnderTest -Value $ResourceGroupUnderTest -Scope Global
$VHDuri = (Get-AzureRMVM -ResourceGroupName $VM.ResourceGroupName).StorageProfile.OsDisk.Vhd.Uri
#Deprovision VM
LogMsg "Executing: waagent -deprovision..."
$DeprovisionInfo = RunLinuxCmd -username $user -password $password -ip $VM.PublicIP -port $VM.SSHPort -command "/usr/sbin/waagent -force -deprovision" -runAsSudo
LogMsg $DeprovisionInfo
LogMsg "Execution of waagent -deprovision done successfully"
LogMsg "Stopping Virtual Machine ...."
$out = Stop-AzureRmVM -ResourceGroupName $VM.ResourceGroupName -Name $VM.RoleName -Force
WaitFor -seconds 60
}
#get the VHD file name from the VHD uri
$VHDuri = Split-Path $VHDuri -Leaf
$Distros = @($xmlConfig.config.Azure.Deployment.Data.Distro)
#add OSVHD element to $xml so that deployment will pick the vhd for future tests
foreach ($distroname in $Distros)
{
if ($distroname.Name -eq $Distro)
{
$xmlConfig.config.Azure.Deployment.Data.Distro[$Distros.IndexOf($distroname)].OsVHD = $VHDuri.ToString()
}
}
#Finally set customKernel and customLIS to null which are not required to be installed after deploying Virtual machine
$customKernel = $null
Set-Variable -Name customKernel -Value $customKernel -Scope Global
$customLIS = $null
Set-Variable -Name customLIS -Value $customLIS -Scope Global
$testResult = "PASS"
$testStatus = "TestCompleted"
LogMsg "Resource Group deployed successfully. VHD is captured and it will be used for further tests"
}
else
{
$testResult = "Aborted"
}
}
elseif($testId.ToUpper() -eq "AZUREBVT_100") {
if($ResourceGroupUnderTest)
{
$out = DeleteResourceGroup -RGName $ResourceGroupUnderTest
LogMsg "Captured VHD is deleted along with the associated Resource Group."
}
$testResult = "PASS"
$testStatus = "TestCompleted"
}
else {
$testResult = "PASS"
$testStatus = "TestCompleted"
LogMsg "Capture VHD is not required since customLIS or customKernel is not specified. Continue with further tests"
}
}
catch {
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
}
$result = GetFinalResultHeader -resultarr $resultArr
return $result