[Windows] win: add validation InstalledSoftware.md and testResults.xml files (#3960)

* win: add validation InstalledSoftware.md file
This commit is contained in:
Aleksandr Chebotov
2021-08-27 09:38:18 +03:00
committed by GitHub
parent ca51829236
commit 5aa96839a8
9 changed files with 50 additions and 11 deletions

View File

@@ -439,7 +439,7 @@ function Get-AndroidPackages {
[string]$AndroidSDKManagerPath
)
return (& $AndroidSDKManagerPath --list --verbose).Trim() | Foreach-Object { $_.Split()[0] } | Where-Object {$_}
return (cmd /c "$AndroidSDKManagerPath --list --verbose 2>&1").Trim() | Foreach-Object { $_.Split()[0] } | Where-Object {$_}
}
function Get-AndroidPackagesByName {

View File

@@ -53,6 +53,10 @@ function Invoke-PesterTests {
if ($TestName) {
$configuration.Filter.FullName = $TestName
}
if ($TestFile -eq "*") {
$configuration.TestResult.Enabled = $true
$configuration.TestResult.OutputPath = "C:\image\Tests\testResults.xml"
}
# Update environment variables without reboot
Update-Environment

View File

@@ -21,7 +21,7 @@ function Get-AndroidSDKManagerPath {
function Get-AndroidInstalledPackages {
$androidSDKManagerPath = Get-AndroidSDKManagerPath
$androidSDKManagerList = & $androidSDKManagerPath --list_installed
$androidSDKManagerList = cmd /c "$androidSDKManagerPath --list_installed 2>&1"
return $androidSDKManagerList
}

View File

@@ -271,8 +271,7 @@ function Get-VisualCPPComponents {
}
function Get-DacFxVersion {
cd "C:\Program Files\Microsoft SQL Server\150\DAC\bin\"
$dacfxversion = (./sqlpackage.exe /version)
$dacfxversion = & "$env:ProgramFiles\Microsoft SQL Server\150\DAC\bin\sqlpackage.exe" /version
return "DacFx $dacfxversion"
}

View File

@@ -13,8 +13,8 @@ function Get-ApacheVersion {
}
function Get-NginxVersion {
$nginxBinPath = Join-Path (Get-NginxPath) "\nginx"
(. $nginxBinPath -v 2>&1 | Select-String -Pattern "nginx/") -match "nginx/(?<version>\d+\.\d+\.\d+)" | Out-Null
$nginxBinPath = Join-Path (Get-NginxPath) "nginx"
(cmd /c "$nginxBinPath -v 2>&1") -match "nginx/(?<version>\d+\.\d+\.\d+)" | Out-Null
return $Matches.Version
}

View File

@@ -1,7 +1,7 @@
Describe "Nginx" {
Context "Path" {
It "Nginx" {
$nginxPath = Join-Path (Join-Path "C:\tools\" (Get-Item C:\tools\nginx*).Name) "\nginx"
$nginxPath = Join-Path (Join-Path "C:\tools\" (Get-Item C:\tools\nginx*).Name) "nginx"
"$nginxPath -v" | Should -ReturnZeroExitCode
}
}

View File

@@ -264,6 +264,12 @@
"{{ template_dir }}/scripts/Tests/RunAll-Tests.ps1"
]
},
{
"type": "powershell",
"inline": [
"if (-not (Test-Path {{user `image_folder`}}\\Tests\\testResults.xml)) { throw '{{user `image_folder`}}\\Tests\\testResults.xml not found' }"
]
},
{
"type": "powershell",
"inline": [
@@ -273,6 +279,12 @@
"IMAGE_VERSION={{user `image_version`}}"
]
},
{
"type": "powershell",
"inline": [
"if (-not (Test-Path C:\\InstalledSoftware.md)) { throw 'C:\\InstalledSoftware.md not found' }"
]
},
{
"type": "file",
"source": "C:\\InstalledSoftware.md",

View File

@@ -239,8 +239,7 @@
"{{ template_dir }}/scripts/Installers/Install-GoogleCloudSDK.ps1",
"{{ template_dir }}/scripts/Installers/Install-CodeQLBundle.ps1",
"{{ template_dir }}/scripts/Installers/Install-BizTalkBuildComponent.ps1",
"{{ template_dir }}/scripts/Installers/Disable-JITDebugger.ps1",
"{{ template_dir }}/scripts/Installers/Run-NGen.ps1"
"{{ template_dir }}/scripts/Installers/Disable-JITDebugger.ps1"
]
},
{
@@ -265,6 +264,12 @@
"{{ template_dir }}/scripts/Tests/RunAll-Tests.ps1"
]
},
{
"type": "powershell",
"inline": [
"if (-not (Test-Path {{user `image_folder`}}\\Tests\\testResults.xml)) { throw '{{user `image_folder`}}\\Tests\\testResults.xml not found' }"
]
},
{
"type": "powershell",
"inline": [
@@ -274,6 +279,12 @@
"IMAGE_VERSION={{user `image_version`}}"
]
},
{
"type": "powershell",
"inline": [
"if (-not (Test-Path C:\\InstalledSoftware.md)) { throw 'C:\\InstalledSoftware.md not found' }"
]
},
{
"type": "file",
"source": "C:\\InstalledSoftware.md",
@@ -283,6 +294,7 @@
{
"type": "powershell",
"scripts": [
"{{ template_dir }}/scripts/Installers/Run-NGen.ps1",
"{{ template_dir }}/scripts/Installers/Finalize-VM.ps1"
]
},

View File

@@ -222,8 +222,7 @@
"{{ template_dir }}/scripts/Installers/Install-RootCA.ps1",
"{{ template_dir }}/scripts/Installers/Install-MongoDB.ps1",
"{{ template_dir }}/scripts/Installers/Install-CodeQLBundle.ps1",
"{{ template_dir }}/scripts/Installers/Disable-JITDebugger.ps1",
"{{ template_dir }}/scripts/Installers/Run-NGen.ps1"
"{{ template_dir }}/scripts/Installers/Disable-JITDebugger.ps1"
]
},
{
@@ -248,6 +247,12 @@
"{{ template_dir }}/scripts/Tests/RunAll-Tests.ps1"
]
},
{
"type": "powershell",
"inline": [
"if (-not (Test-Path {{user `image_folder`}}\\Tests\\testResults.xml)) { throw '{{user `image_folder`}}\\Tests\\testResults.xml not found' }"
]
},
{
"type": "powershell",
"inline": [
@@ -257,6 +262,12 @@
"IMAGE_VERSION={{user `image_version`}}"
]
},
{
"type": "powershell",
"inline": [
"if (-not (Test-Path C:\\InstalledSoftware.md)) { throw 'C:\\InstalledSoftware.md not found' }"
]
},
{
"type": "file",
"source": "C:\\InstalledSoftware.md",
@@ -266,6 +277,7 @@
{
"type": "powershell",
"scripts": [
"{{ template_dir }}/scripts/Installers/Run-NGen.ps1",
"{{ template_dir }}/scripts/Installers/Finalize-VM.ps1"
]
},