mirror of
https://github.com/actions/runner-images.git
synced 2026-01-04 09:13:33 +08:00
* first part * fix session manager plugin * rework AWS installation * azure cosmos db tests * azure devops cli * add azmodules test * put brackets * add root folder * remove validate aliyun * add azure modules * update modules test * docker, baze, dotnetsdk * DACFx * add azdevopscli * change to Should -BeTrue * nitpicks * remove extra * add azurecli * remove BeforeAll for DACFx * a bit of refactoring * fix templates * remove disk space validation * rename to powershell modules * fix templates
This commit is contained in:
26
images/win/scripts/Tests/DotnetSDK.Tests.ps1
Normal file
26
images/win/scripts/Tests/DotnetSDK.Tests.ps1
Normal file
@@ -0,0 +1,26 @@
|
||||
$releaseIndexUrl = "https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json"
|
||||
$dotnetChannels = (New-Object system.net.webclient).DownloadString($releaseIndexUrl) | ConvertFrom-Json
|
||||
$dotnetVersions = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol')) } | Select-Object -ExpandProperty "channel-version"
|
||||
|
||||
Describe "Dotnet SDK" {
|
||||
|
||||
Context "Default" {
|
||||
It "Default Dotnet SDK is available" {
|
||||
"dotnet --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($version in $dotnetVersions) {
|
||||
Context "Dotnet $version" {
|
||||
$dotnet = @{ dotnetVersion = $version }
|
||||
|
||||
It "SDK $version is available" -TestCases $dotnet {
|
||||
(dotnet --list-sdks | Where-Object { $_ -match "${dotnetVersion}\.[0-9]*" }).Count | Should -BeGreaterThan 0
|
||||
}
|
||||
|
||||
It "Runtime $version is available" -TestCases $dotnet {
|
||||
(dotnet --list-runtimes | Where-Object { $_ -match "${dotnetVersion}\.[0-9]*" }).Count | Should -BeGreaterThan 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
44
images/win/scripts/Tests/PowerShellModules.Tests.ps1
Normal file
44
images/win/scripts/Tests/PowerShellModules.Tests.ps1
Normal file
@@ -0,0 +1,44 @@
|
||||
Describe "AzureModules" {
|
||||
$modules = (Get-ToolsetContent).azureModules
|
||||
$modulesRootPath = $env:PSMODULES_ROOT_FOLDER
|
||||
|
||||
foreach ($module in $modules) {
|
||||
$moduleName = $module.name
|
||||
|
||||
Context "$moduleName" {
|
||||
|
||||
foreach ($version in $module.versions) {
|
||||
$modulePath = Join-Path -Path $modulesRootPath -ChildPath "${moduleName}_${version}"
|
||||
$moduleInfo = @{ moduleName = $moduleName; modulePath = $modulePath; expectedVersion = $version }
|
||||
It "<expectedVersion> exists in modules directory" -TestCases $moduleInfo {
|
||||
$testJob = Start-Job -ScriptBlock {
|
||||
param (
|
||||
$modulePath,
|
||||
$moduleName
|
||||
)
|
||||
|
||||
# Disable warning messages to prevent additional warnings about Az and Azurerm modules in the same session
|
||||
$WarningPreference = "SilentlyContinue"
|
||||
|
||||
$env:PsModulePath = "$modulePath;$env:PsModulePath"
|
||||
Import-Module -Name $moduleName
|
||||
(Get-Module -Name $moduleName).Version.ToString()
|
||||
|
||||
} -ArgumentList $modulePath, $moduleName
|
||||
|
||||
$moduleVersion = $testJob | Wait-Job | Receive-Job
|
||||
Remove-Job $testJob
|
||||
$moduleVersion | Should -Match $expectedVersion
|
||||
}
|
||||
}
|
||||
|
||||
if ($module.default) {
|
||||
$moduleInfo = @{ moduleName = $moduleName; moduleDefault = $module.default }
|
||||
It "<moduleDefault> set as default" -TestCases $moduleInfo {
|
||||
$moduleVersion = (Get-Module -ListAvailable -Name $moduleName).Version.ToString()
|
||||
$moduleVersion | Should -Match $moduleDefault
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,96 @@ Describe "7-Zip" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "AliyunCli" {
|
||||
It "AliyunCli" {
|
||||
"aliyun version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "AWS" {
|
||||
It "AWS CLI" {
|
||||
"aws --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
It "Session Manager Plugin for the AWS CLI" {
|
||||
session-manager-plugin | Out-String | Should -Match "plugin was installed successfully"
|
||||
}
|
||||
|
||||
It "AWS SAM CLI" {
|
||||
"sam --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "AzCopy" {
|
||||
It "AzCopy" {
|
||||
"azcopy --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Azure Cosmos DB Emulator" {
|
||||
$cosmosDbEmulatorRegKey = Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" | Get-ItemProperty | Where-Object { $_.DisplayName -eq 'Azure Cosmos DB Emulator' }
|
||||
$installDir = $cosmosDbEmulatorRegKey.InstallLocation
|
||||
|
||||
It "Azure Cosmos DB Emulator install location registry key exists" -TestCases @{installDir = $installDir} {
|
||||
$installDir | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It "Azure Cosmos DB Emulator exe file exists" -TestCases @{installDir = $installDir} {
|
||||
$exeFilePath = Join-Path $installDir 'CosmosDB.Emulator.exe'
|
||||
$exeFilePath | Should -Exist
|
||||
}
|
||||
}
|
||||
|
||||
Describe "AzureCli" {
|
||||
It "AzureCli" {
|
||||
"az --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Azure DevOps CLI" {
|
||||
It "az devops" {
|
||||
"az devops -h" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Bazel" {
|
||||
It "<ToolName>" -TestCases @(
|
||||
@{ ToolName = "bazel" }
|
||||
@{ ToolName = "bazelisk" }
|
||||
) {
|
||||
"$ToolName --version"| Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "CMake" {
|
||||
It "cmake" {
|
||||
"cmake --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "DACFx" {
|
||||
It "DACFx" {
|
||||
(Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*).DisplayName -Contains "Microsoft SQL Server Data-Tier Application Framework (x64)" | Should -BeTrue
|
||||
$sqlPackagePath = 'C:\Program Files\Microsoft SQL Server\150\DAC\bin\SqlPackage.exe'
|
||||
$sqlLocalDBPath = 'C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe'
|
||||
"${sqlPackagePath}" | Should -Exist
|
||||
"${sqlLocalDBPath}" | Should -Exist
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Docker" {
|
||||
It "<ToolName>" -TestCases @(
|
||||
@{ ToolName = "docker" }
|
||||
@{ ToolName = "docker-compose" }
|
||||
) {
|
||||
"$ToolName --version"| Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
It "Helm" {
|
||||
"helm version --short" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Kind" {
|
||||
It "Kind" {
|
||||
"kind version" | Should -ReturnZeroExitCode
|
||||
|
||||
Reference in New Issue
Block a user