mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 12:48:18 +00: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:
@@ -167,12 +167,6 @@
|
||||
"type": "windows-restart",
|
||||
"restart_timeout": "30m"
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Docker.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -483,12 +477,6 @@
|
||||
"{{ template_dir }}/scripts/Installers/Install-AWS.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Install-AWS-SAM.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -656,70 +644,12 @@
|
||||
"type": "windows-restart",
|
||||
"restart_timeout": "30m"
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"environment_vars":[
|
||||
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}",
|
||||
"PSMODULES_ROOT_FOLDER={{user `psmodules_root_folder`}}"
|
||||
],
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AzureCli.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AWS-SAM.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AzureDevOpsCli.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AzCopy.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Svn.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Bazel.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AliyunCli.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-DACFx.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-DotnetSDK.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -738,12 +668,6 @@
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Stack.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -781,6 +705,7 @@
|
||||
],
|
||||
"environment_vars":[
|
||||
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}",
|
||||
"PSMODULES_ROOT_FOLDER={{user `psmodules_root_folder`}}",
|
||||
"ROOT_FOLDER={{user `root_folder`}}"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -175,12 +175,6 @@
|
||||
"type": "windows-restart",
|
||||
"restart_timeout": "10m"
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Docker.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -458,12 +452,6 @@
|
||||
"{{ template_dir }}/scripts/Installers/Install-AWS.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Install-AWS-SAM.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -655,58 +643,12 @@
|
||||
"type": "windows-restart",
|
||||
"restart_timeout": "10m"
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"environment_vars":[
|
||||
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}",
|
||||
"PSMODULES_ROOT_FOLDER={{user `psmodules_root_folder`}}"
|
||||
],
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AzureCli.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AWS-SAM.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AzureDevOpsCli.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AzCopy.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Svn.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-DACFx.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-DotnetSDK.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -725,12 +667,6 @@
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Stack.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -749,18 +685,6 @@
|
||||
"{{ template_dir }}/scripts/Installers/Validate-VSWhere.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Bazel.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AliyunCli.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -780,6 +704,7 @@
|
||||
],
|
||||
"environment_vars":[
|
||||
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}",
|
||||
"PSMODULES_ROOT_FOLDER={{user `psmodules_root_folder`}}",
|
||||
"ROOT_FOLDER={{user `root_folder`}}"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
################################################################################
|
||||
## File: Install-AWS-SAM.ps1
|
||||
## Desc: Install aws sam cli
|
||||
## https://aws.amazon.com/serverless/sam/
|
||||
################################################################################
|
||||
|
||||
Install-Binary -Url "https://github.com/awslabs/aws-sam-cli/releases/latest/download/AWS_SAM_CLI_64_PY3.msi" -Name "AWS_SAM_CLI_64_PY3.msi"
|
||||
@@ -1,28 +1,18 @@
|
||||
################################################################################
|
||||
## File: Install-awscli.ps1
|
||||
## Desc: Install awscli
|
||||
## File: Install-AWS.ps1
|
||||
## Desc: Install AWS tools(AWS CLI, Session Manager Plugin for the AWS CLI, AWS SAM CLI)
|
||||
################################################################################
|
||||
|
||||
# Install AWS CLI
|
||||
Choco-Install -PackageName awscli
|
||||
|
||||
$env:Path = $env:Path + ";$env:ProgramFiles\Amazon\AWSCLIV2"
|
||||
if (Get-Command -Name 'aws')
|
||||
{
|
||||
Write-Host 'awscli on path'
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host 'awscli is not on path'
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Install Session Manager Plugin for the AWS CLI
|
||||
$sessionManagerName = "SessionManagerPluginSetup.exe"
|
||||
$sessionManagerUrl = "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/windows/$sessionManagerName"
|
||||
Install-Binary -Url $sessionManagerUrl -Name $sessionManagerName -ArgumentList ("/silent", "/install")
|
||||
$env:Path = $env:Path + ";$env:ProgramFiles\Amazon\SessionManagerPlugin\bin"
|
||||
|
||||
$sessionMessage = session-manager-plugin
|
||||
Write-Host "$sessionMessage"
|
||||
if ($sessionMessage -notmatch "*plugin was installed successfully*") {
|
||||
exit 1
|
||||
}
|
||||
# Install AWS SAM CLI
|
||||
Install-Binary -Url "https://github.com/awslabs/aws-sam-cli/releases/latest/download/AWS_SAM_CLI_64_PY3.msi" -Name "AWS_SAM_CLI_64_PY3.msi"
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "AWS"
|
||||
@@ -4,3 +4,5 @@
|
||||
################################################################################
|
||||
|
||||
Choco-Install -PackageName aliyun-cli
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "AliyunCli"
|
||||
@@ -4,3 +4,5 @@
|
||||
################################################################################
|
||||
|
||||
Choco-Install -PackageName azcopy10
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "AzCopy"
|
||||
@@ -10,3 +10,4 @@ New-Item -ItemType "directory" -Path $AzureCliExtensionPath
|
||||
|
||||
[Environment]::SetEnvironmentVariable("AZURE_EXTENSION_DIR", $AzureCliExtensionPath, [System.EnvironmentVariableTarget]::Machine)
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "AzureCli"
|
||||
@@ -9,3 +9,5 @@ $InstallerName = "AzureCosmosDBEmulator.msi"
|
||||
$InstallerUrl = "https://aka.ms/cosmosdb-emulator"
|
||||
|
||||
Install-Binary -Url $InstallerUrl -Name $InstallerName
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "Azure Cosmos DB Emulator"
|
||||
@@ -4,3 +4,5 @@
|
||||
################################################################################
|
||||
|
||||
az extension add -n azure-devops
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "Azure DevOps CLI"
|
||||
@@ -53,3 +53,5 @@ foreach ($module in $modules)
|
||||
# Add modules to the PSModulePath
|
||||
$psModuleMachinePath += $env:PSModulePath
|
||||
[Environment]::SetEnvironmentVariable("PSModulePath", $psModuleMachinePath, "Machine")
|
||||
|
||||
Invoke-PesterTests -TestFile "PowerShellModules" -TestName "AzureModules"
|
||||
@@ -6,3 +6,5 @@
|
||||
Choco-Install -PackageName bazel
|
||||
|
||||
npm install -g @bazel/bazelisk
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "Bazel"
|
||||
@@ -9,3 +9,5 @@ $InstallerName = "DacFramework.msi"
|
||||
$InstallerUrl = "https://go.microsoft.com/fwlink/?linkid=2128142"
|
||||
|
||||
Install-Binary -Url $InstallerUrl -Name $InstallerName
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "DACFx"
|
||||
@@ -18,3 +18,5 @@ Choco-Install -PackageName docker-compose
|
||||
|
||||
Write-Host "Install Helm"
|
||||
Choco-Install -PackageName kubernetes-helm
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "Docker"
|
||||
@@ -113,3 +113,5 @@ function RunPostInstallationSteps()
|
||||
|
||||
InstallAllValidSdks
|
||||
RunPostInstallationSteps
|
||||
|
||||
Invoke-PesterTests -TestFile "DotnetSDK"
|
||||
@@ -1,14 +0,0 @@
|
||||
################################################################################
|
||||
## File: Validate-AWS-SAM.ps1
|
||||
## Desc: Validate aws sam cli
|
||||
################################################################################
|
||||
|
||||
if (Get-Command -Name 'sam')
|
||||
{
|
||||
Write-Host 'AWS SAM CLI on path'
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host 'AWS SAM CLI is not on path'
|
||||
exit 1
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
################################################################################
|
||||
## File: Validate-AliyunCli.ps1
|
||||
## Desc: Validate Alibaba Cloud CLI
|
||||
################################################################################
|
||||
|
||||
if (Get-Command -Name 'aliyun')
|
||||
{
|
||||
Write-Host 'Alibaba Cloud CLI on path'
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host 'Alibaba Cloud CLI is not on path'
|
||||
exit 1
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
################################################################################
|
||||
## File: Validate-AzCopy.ps1
|
||||
## Desc: Validate AzCopy10
|
||||
################################################################################
|
||||
if (Get-Command -Name 'azcopy') {
|
||||
Write-Host "$(azcopy --version) on path"
|
||||
} else {
|
||||
Write-Error "azcopy not on path"
|
||||
exit 1
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
################################################################################
|
||||
## File: Validate-AzureCosmosDbEmulator.ps1
|
||||
## Desc: Validate Azure CosmosDb Emulator installation.
|
||||
################################################################################
|
||||
|
||||
$SoftwareName = 'Azure CosmosDb Emulator'
|
||||
$regKey = gci HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | gp | ? { $_.DisplayName -eq 'Azure Cosmos DB Emulator' }
|
||||
|
||||
if ($regKey -eq $null)
|
||||
{
|
||||
Write-Host "The $regKey registry key is not set"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "The $regKey registry key is set"
|
||||
}
|
||||
|
||||
$installDir = $regKey.InstallLocation
|
||||
if ($installDir -eq $null)
|
||||
{
|
||||
Write-Host "The $SoftwareName installation directory registry value is not set"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "The $SoftwareName installation directory registry value is set to: $installDir"
|
||||
}
|
||||
|
||||
$exeFilePath = Join-Path $installDir 'CosmosDB.Emulator.exe'
|
||||
if (!(Test-Path $exeFilePath))
|
||||
{
|
||||
Write-Host "$SoftwareName is not installed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$fileVersion = (Get-Item $exeFilePath).VersionInfo.FileVersion
|
||||
Write-Host "$SoftwareName is successfully installed: $fileVersion"
|
||||
@@ -1,17 +0,0 @@
|
||||
################################################################################
|
||||
## File: Validate-AzureDevOpsCli.ps1
|
||||
## Desc: Validate Azure DevOps CLI
|
||||
################################################################################
|
||||
|
||||
az devops -h
|
||||
|
||||
if ($LastExitCode -ne 0)
|
||||
{
|
||||
Write-Error "Azure DevOps Cli extension not present"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "Azure DevOps Cli extension is present"
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
################################################################################
|
||||
## File: Validate-AzureModules.ps1
|
||||
## Desc: Validate Azure PowerShell modules
|
||||
################################################################################
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$modulesRootPath = $env:PSMODULES_ROOT_FOLDER
|
||||
|
||||
# Get modules content from toolset
|
||||
$modules = (Get-ToolsetContent).azureModules
|
||||
|
||||
foreach ($module in $modules)
|
||||
{
|
||||
foreach ($version in $module.versions)
|
||||
{
|
||||
$moduleName = $module.name
|
||||
$modulePath = Join-Path -Path $modulesRootPath -ChildPath "$($module.name)_${version}"
|
||||
|
||||
Write-Host "Trying to import ${moduleName}_${version}..."
|
||||
$testJob = Start-Job -ScriptBlock {
|
||||
param (
|
||||
$modulePath,
|
||||
$moduleName
|
||||
)
|
||||
|
||||
$env:PsModulePath = "$modulePath;$env:PsModulePath"
|
||||
Import-Module -Name $moduleName
|
||||
Get-Module -Name $moduleName
|
||||
|
||||
} -ArgumentList $modulePath, $moduleName
|
||||
|
||||
$isError = $testJob | Wait-Job | Foreach-Object ChildJobs | Where-Object { $_.Error }
|
||||
if ($isError)
|
||||
{
|
||||
Write-Host "Required ${moduleName} module ${version} version is not present"
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
$testJob | Receive-Job | Select-Object Name,Version,Path
|
||||
Remove-Job $testJob
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
################################################################################
|
||||
## File: Validate-Bazel.ps1
|
||||
## Desc: Validate Bazel and Bazelisk (A user-friendly launcher for Bazel)
|
||||
################################################################################
|
||||
|
||||
if (Get-Command -Name 'bazel')
|
||||
{
|
||||
Write-Host 'bazel on path'
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host 'bazel is not on path'
|
||||
exit 1
|
||||
}
|
||||
|
||||
if (Get-Command -Name 'bazelisk')
|
||||
{
|
||||
Write-Host 'bazelisk on path'
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host 'bazelisk is not on path'
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
####################################################################################
|
||||
## File: Validate-DACFx.ps1
|
||||
## Desc: Validate SQL Server® Data-Tier Application Framework (DACFx) for Windows
|
||||
####################################################################################
|
||||
|
||||
$env:PATH = $env:Path + ';C:\Program Files\Microsoft SQL Server\120\DAC\bin;C:\Program Files\Microsoft SQL Server\130\DAC\bin;C:\Program Files\Microsoft SQL Server\140\DAC\bin;C:\Program Files\Microsoft SQL Server\150\DAC\bin'
|
||||
|
||||
if (Get-Command -Name 'SqlPackage')
|
||||
{
|
||||
Write-Host "DACFx is installed at path" (Get-Command -Name 'SqlPackage').Source
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "DACFx is not installed!"
|
||||
}
|
||||
|
||||
if (Get-Command -Name 'SqlLocalDB')
|
||||
{
|
||||
Write-Host "SQL Server Express LocalDB is available at " (Get-Command -Name SqlLocalDB).Source
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "SqlLocalDB is not installed!"
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
################################################################################
|
||||
## File: Validate-Docker.ps1
|
||||
## Desc: Validate Docker.
|
||||
################################################################################
|
||||
|
||||
if ((Get-Command -Name 'docker') -and (Get-Command -Name 'docker-compose'))
|
||||
{
|
||||
Write-Host "docker $(docker version) on path"
|
||||
Write-Host "docker-compose $(docker-compose version) on path"
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "docker or docker-compose are not on path"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Validate helm
|
||||
if (Get-Command -Name 'helm')
|
||||
{
|
||||
Write-Host "helm on path"
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host 'helm is not on path'
|
||||
exit 1
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
################################################################################
|
||||
## File: Validate-DotnetSDK.ps1
|
||||
## Desc: Validate dotnet
|
||||
################################################################################
|
||||
|
||||
if (Get-Command -Name 'dotnet')
|
||||
{
|
||||
Write-Host "dotnet $(dotnet --version) on path"
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "dotnet is not on path"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
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