зеркало из https://github.com/microsoft/lisa.git
Added Demo Tests
These tests are for framework verification.
This commit is contained in:
Родитель
12d8654abd
Коммит
6e12914789
|
@ -140,6 +140,10 @@ try
|
|||
{
|
||||
mkdir $testResults | out-null
|
||||
}
|
||||
if (! (test-path ".\report"))
|
||||
{
|
||||
mkdir ".\report" | out-null
|
||||
}
|
||||
$testStartTime = [DateTime]::Now.ToUniversalTime()
|
||||
Set-Variable -Name testStartTime -Value $testStartTime -Scope Global
|
||||
$testDir = $testResults + "\" + $cycleName + "-" + $testStartTime.ToString("yyyyMMddHHmmssff")
|
||||
|
@ -148,11 +152,11 @@ try
|
|||
Set-Content -Value "" -Path .\report\AdditionalInfo.html -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
$logFile = $testDir + "\" + "AzureLogs.txt"
|
||||
Set-Variable -Name logfile -Value $logFile -Scope Global
|
||||
Set-Content -Path .\report\lastLogDirectory.txt -Value $testDir -ErrorAction SilentlyContinue
|
||||
Set-Variable -Name Distro -Value $RGIdentifier -Scope Global
|
||||
Set-Variable -Name onCloud -Value $onCloud -Scope Global
|
||||
Set-Variable -Name xmlConfig -Value $xmlConfig -Scope Global
|
||||
Set-Content -Path .\report\lastLogDirectory.txt -Value $testDir -ErrorAction SilentlyContinue
|
||||
LogMsg = "'$testDir' saved to .\report\lastLogDirectory.txt"
|
||||
Set-Content -Path .\report\lastLogDirectory.txt -Value $testDir -Force
|
||||
Set-Variable -Name vnetIsAllConfigured -Value $false -Scope Global
|
||||
if($EconomyMode)
|
||||
{
|
||||
|
|
|
@ -1920,7 +1920,15 @@ Function DoTestCleanUp($result, $testName, $DeployedServices, $ResourceGroups, [
|
|||
}
|
||||
else
|
||||
{
|
||||
$RGdetails = Get-AzureRmResourceGroup -Name $group
|
||||
try
|
||||
{
|
||||
$RGdetails = Get-AzureRmResourceGroup -Name $group -ErrorAction SilentlyContinue
|
||||
}
|
||||
catch
|
||||
{
|
||||
LogMsg "Resource group '$group' not found."
|
||||
}
|
||||
|
||||
if ( $RGdetails.Tags )
|
||||
{
|
||||
if ( ( $RGdetails.Tags[0].Name -eq $preserveKeyword ) -and ( $RGdetails.Tags[0].Value -eq "yes" ))
|
||||
|
@ -2613,8 +2621,9 @@ Function GetFilePathsFromLinuxFolder ([string]$folderToSearch, $IpAddress, $SSHP
|
|||
|
||||
function ZipFiles( $zipfilename, $sourcedir )
|
||||
{
|
||||
LogMsg "Creating '$zipfilename' from '$sourcedir'"
|
||||
$currentDir = (Get-Location).Path
|
||||
$7z = (Get-ChildItem .\tools\7za.exe).FullName
|
||||
$7z = (Get-ChildItem .\Tools\7za.exe).FullName
|
||||
$sourcedir = $sourcedir.Trim('\')
|
||||
cd $sourcedir
|
||||
$out = Invoke-Expression "$7z a -mx5 $currentDir\$zipfilename * -r"
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
$result = ""
|
||||
$testResult = ""
|
||||
$resultArr = @()
|
||||
|
||||
$isDeployed = "THIS-IS-DEMO-FAIL"
|
||||
if ($isDeployed)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogMsg "Test Result : Aborted."
|
||||
$testResult = "Aborted"
|
||||
}
|
||||
catch
|
||||
{
|
||||
$ErrorMessage = $_.Exception.Message
|
||||
LogMsg "EXCEPTION : $ErrorMessage"
|
||||
}
|
||||
Finally
|
||||
{
|
||||
$metaData = ""
|
||||
if (!$testResult)
|
||||
{
|
||||
$testResult = "Aborted"
|
||||
}
|
||||
$resultArr += $testResult
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$testResult = "FAIL"
|
||||
$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,41 @@
|
|||
$result = ""
|
||||
$testResult = ""
|
||||
$resultArr = @()
|
||||
|
||||
$isDeployed = "THIS-IS-DEMO-FAIL"
|
||||
if ($isDeployed)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogMsg "Test Result : FAIL."
|
||||
$testResult = "FAIL"
|
||||
}
|
||||
catch
|
||||
{
|
||||
$ErrorMessage = $_.Exception.Message
|
||||
LogMsg "EXCEPTION : $ErrorMessage"
|
||||
}
|
||||
Finally
|
||||
{
|
||||
$metaData = ""
|
||||
if (!$testResult)
|
||||
{
|
||||
$testResult = "Aborted"
|
||||
}
|
||||
$resultArr += $testResult
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$testResult = "FAIL"
|
||||
$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,41 @@
|
|||
$result = ""
|
||||
$testResult = ""
|
||||
$resultArr = @()
|
||||
|
||||
$isDeployed = "THIS-IS-DEMO-TEST"
|
||||
if ($isDeployed)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogMsg "Test Result : PASS."
|
||||
$testResult = "PASS"
|
||||
}
|
||||
catch
|
||||
{
|
||||
$ErrorMessage = $_.Exception.Message
|
||||
LogMsg "EXCEPTION : $ErrorMessage"
|
||||
}
|
||||
Finally
|
||||
{
|
||||
$metaData = ""
|
||||
if (!$testResult)
|
||||
{
|
||||
$testResult = "Aborted"
|
||||
}
|
||||
$resultArr += $testResult
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$testResult = "FAIL"
|
||||
$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,35 @@
|
|||
<TestCases>
|
||||
<test>
|
||||
<TestName>DEMO-TEST-PASS</TestName>
|
||||
<PowershellScript>DEMO-TEST-PASS.ps1</PowershellScript>
|
||||
<files></files>
|
||||
<setupType>SingleVM</setupType>
|
||||
<Platform>Azure</Platform>
|
||||
<Category>Demo</Category>
|
||||
<Area>Demo</Area>
|
||||
<Tags>demo</Tags>
|
||||
<TestID>Demo_001</TestID>
|
||||
</test>
|
||||
<test>
|
||||
<TestName>DEMO-TEST-FAIL</TestName>
|
||||
<PowershellScript>DEMO-TEST-FAIL.ps1</PowershellScript>
|
||||
<files></files>
|
||||
<setupType>SingleVM</setupType>
|
||||
<Platform>Azure</Platform>
|
||||
<Category>Demo</Category>
|
||||
<Area>Demo</Area>
|
||||
<Tags>demo</Tags>
|
||||
<TestID>Demo_002</TestID>
|
||||
</test>
|
||||
<test>
|
||||
<TestName>DEMO-TEST-Aborted</TestName>
|
||||
<PowershellScript>DEMO-TEST-Aborted.ps1</PowershellScript>
|
||||
<files></files>
|
||||
<setupType>SingleVM</setupType>
|
||||
<Platform>Azure</Platform>
|
||||
<Category>Demo</Category>
|
||||
<Area>Demo</Area>
|
||||
<Tags>demo</Tags>
|
||||
<TestID>Demo_003</TestID>
|
||||
</test>
|
||||
</TestCases>
|
Загрузка…
Ссылка в новой задаче