Merge branch 'master' into v-vlsafo/add-dotnettls-pester

This commit is contained in:
Vladimir Safonkin
2020-07-15 08:26:27 +03:00
42 changed files with 375 additions and 563 deletions

View File

@@ -34,9 +34,9 @@ function AddBlockquote {
}
function StartCode {
WriteItem "``````"
WriteItem '```'
}
function EndCode {
WriteItem "``````"
WriteItem '```'
}

View File

@@ -754,18 +754,6 @@
"{{ template_dir }}/scripts/Installers/Validate-Perl.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Git.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-GitHub-CLI.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -778,12 +766,6 @@
"{{ template_dir }}/scripts/Installers/Validate-Rust.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Julia.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -796,30 +778,6 @@
"{{ template_dir }}/scripts/Installers/Validate-Svn.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Chrome.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Edge.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Firefox.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-SeleniumWebDrivers.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -862,24 +820,12 @@
"{{ template_dir }}/scripts/Installers/Validate-SQLPowerShellTools.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Mingw64.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-TypeScript.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Haskell.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -904,48 +850,18 @@
"{{ template_dir }}/scripts/Installers/Validate-Packer.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Mercurial.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Jq.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Zstd.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-InnoSetup.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-GitVersion.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-NSIS.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-CloudFoundryCli.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -958,18 +874,6 @@
"{{ template_dir }}/scripts/Installers/Validate-VSWhere.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-KubernetesCli.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-GoogleCloudSDK.ps1"
]
},
{
"type": "powershell",
"scripts":[

View File

@@ -1,6 +1,6 @@
# Microsoft Windows Server 2016 Datacenter
- OS Version: 10.0.14393 Build 3750
- Image Version: 20200628.0
- Image Version: 20200706.1
## Installed Software
### Language and Runtime
@@ -9,14 +9,14 @@
- Java 11.0.7
- Java 13.0.2
- Rust 1.44.1
- Python 3.7.7
- Python 3.7.8
- Ruby 2.5.8p224
- Go 1.14.4
- PHP 7.4.7
- Julia 1.4.2
- Perl 5.30.2
- PowerShell 7.0.2
- Node 12.18.1
- Node 12.18.2
### Package Management
- Chocolatey 0.10.15
@@ -34,11 +34,11 @@
- Ant 1.10.5
- Maven 3.6.3
- Gradle 6.5
- sbt 1.3.12
- sbt 1.3.13
### Tools
- Azure CosmosDb Emulator 2.11.1.0
- Bazel 3.3.0
- Bazel 3.3.1
- Bazelisk 1.5.0
- CMake 3.17.3
- Docker 19.03.5
@@ -70,19 +70,19 @@
- Azure CLI 2.8.0
- azcopy 10.4.3
- Azure DevOps CLI extension 0.18.0
- AWS CLI 2.0.26
- AWS CLI 2.0.28
- AWS SAM CLI 0.53.0
- Alibaba CLI 3.0.26
- Cloud Foundry CLI 6.51.0
- Hub CLI 2.14.2
- Google Cloud SDK 298.0.0
- Google Cloud SDK 299.0.0
### Browsers and webdrivers
- Google Chrome 83.0.4103.116
- Chrome Driver 83.0.4103.39
- Microsoft Edge 83.0.478.56
- Microsoft Edge Driver 83.0.478.56
- Mozilla Firefox 77.0.1
- Microsoft Edge 83.0.478.58
- Microsoft Edge Driver 83.0.478.58
- Mozilla Firefox 78.0.1
- Gecko Driver 0.26.0
- IE Driver 3.150.1.0
@@ -140,7 +140,7 @@ Note: MSYS2 is pre-installed on image but not added to PATH.
| 2.7.18 | x64, x86 |
| 3.5.4 | x64, x86 |
| 3.6.8 | x64, x86 |
| 3.7.7 (Default) | x64, x86 |
| 3.7.8 (Default) | x64, x86 |
| 3.8.3 | x64, x86 |
@@ -165,7 +165,7 @@ Note: MSYS2 is pre-installed on image but not added to PATH.
#### PostgreSQL
| Version | UserName | Password | EnvironmentVariables | Path | ServiceName | ServiceStatus | ServiceStartType |
| ------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ----------------- | ------------- | ---------------- |
| 12.3 | postgres | root | PGBIN=C:\Program Files\PostgreSQL\12\bin; <br> PGDATA=C:\Program Files\PostgreSQL\12\data; <br> PGROOT=C:\Program Files\PostgreSQL\12 | C:\Program Files\PostgreSQL\12 | postgresql-x64-12 | Running | Auto |
| 12.3 | postgres | root | PGBIN=C:\Program Files\PostgreSQL\12\bin; <br> PGDATA=C:\Program Files\PostgreSQL\12\data; <br> PGROOT=C:\Program Files\PostgreSQL\12 | C:\Program Files\PostgreSQL\12 | postgresql-x64-12 | Stopped | Disabled |
#### MongoDB
@@ -449,11 +449,11 @@ Note: MSYS2 is pre-installed on image but not added to PATH.
- 4.6.1 4.6.2 4.7 4.7.1 4.7.2 4.8
### Azure Powershell Modules
| Module | Version | Path |
| ------- | --------------------------------------------------------------- | ------------------------------ |
| Az | 1.0.0<br>1.6.0<br>2.3.2<br>2.6.0<br>3.1.0<br>3.5.0<br>3.8.0 | C:\Modules\az_\<version\> |
| Azure | 2.1.0 [Installed]<br>3.8.0<br>4.2.1<br>5.1.1<br>5.3.0 | C:\Modules\azure_\<version\> |
| AzureRM | 2.1.0 [Installed]<br>3.8.0<br>4.2.1<br>5.1.1<br>6.7.0<br>6.13.1 | C:\Modules\azurerm_\<version\> |
| Module | Version | Path |
| ------- | -------------------------------------------------------------------- | ------------------------------ |
| Az | 1.0.0<br>1.6.0<br>2.3.2<br>2.6.0<br>3.1.0<br>3.5.0<br>3.8.0<br>4.3.0 | C:\Modules\az_\<version\> |
| Azure | 2.1.0 [Installed]<br>3.8.0<br>4.2.1<br>5.1.1<br>5.3.0 | C:\Modules\azure_\<version\> |
| AzureRM | 2.1.0 [Installed]<br>3.8.0<br>4.2.1<br>5.1.1<br>6.7.0<br>6.13.1 | C:\Modules\azurerm_\<version\> |
```
Azure PowerShell module 2.1.0 and AzureRM PowerShell module 2.1.0 are installed
and are available via 'Get-Module -ListAvailable'.

View File

@@ -753,18 +753,6 @@
"{{ template_dir }}/scripts/Installers/Validate-Perl.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Git.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-GitHub-CLI.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -777,12 +765,6 @@
"{{ template_dir }}/scripts/Installers/Validate-Rust.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Julia.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -795,30 +777,6 @@
"{{ template_dir }}/scripts/Installers/Validate-Sbt.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Chrome.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Edge.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Firefox.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-SeleniumWebDrivers.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -849,24 +807,12 @@
"{{ template_dir }}/scripts/Installers/Validate-SQLPowerShellTools.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Mingw64.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-TypeScript.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Haskell.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -891,48 +837,18 @@
"{{ template_dir }}/scripts/Installers/Validate-Packer.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Mercurial.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Jq.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Zstd.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-InnoSetup.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-GitVersion.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-NSIS.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-CloudFoundryCli.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -951,12 +867,6 @@
"{{ template_dir }}/scripts/Installers/Validate-VSWhere.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-KubernetesCli.ps1"
]
},
{
"type": "powershell",
"scripts":[
@@ -969,12 +879,6 @@
"{{ template_dir }}/scripts/Installers/Validate-AliyunCli.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-GoogleCloudSDK.ps1"
]
},
{
"type": "powershell",
"scripts":[

View File

@@ -91,6 +91,39 @@ function ShouldReturnZeroExitCode {
}
}
# Pester Assert to match output of command
function ShouldMatchCommandOutput {
Param(
[String] $ActualValue,
[String] $RegularExpression,
[switch] $Negate
)
$output = (Get-CommandResult $ActualValue).Output | Out-String
[bool] $succeeded = $output -cmatch $RegularExpression
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage = ''
if (-not $succeeded) {
if ($Negate) {
$failureMessage = "Expected regular expression '$RegularExpression' for '$ActualValue' command to not match '$output', but it did match."
}
else {
$failureMessage = "Expected regular expression '$RegularExpression' for '$ActualValue' command to match '$output', but it did not match."
}
}
return [PSCustomObject] @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
If (Get-Command -Name Add-AssertionOperator -ErrorAction SilentlyContinue) {
Add-AssertionOperator -Name ReturnZeroExitCode -InternalName ShouldReturnZeroExitCode -Test ${function:ShouldReturnZeroExitCode}
Add-AssertionOperator -Name MatchCommandOutput -InternalName ShouldMatchCommandOutput -Test ${function:ShouldMatchCommandOutput}
}

View File

@@ -74,4 +74,6 @@ setx ChromeWebDriver "$ChromeDriverPath" /M
$regEnvKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\'
$PathValue = Get-ItemPropertyValue -Path $regEnvKey -Name 'Path'
$PathValue += ";$ChromeDriverPath\"
Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $PathValue
Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $PathValue
Invoke-PesterTests -TestFile "Browsers" -TestName "Chrome"

View File

@@ -20,4 +20,6 @@ Write-Host "Extracting cf cli..."
Extract-7Zip -Path $CloudFoundryArchPath -DestinationPath $CloudFoundryCliPath
# Add cf to path
Add-MachinePathItem $CloudFoundryCliPath
Add-MachinePathItem $CloudFoundryCliPath
Invoke-PesterTests -TestFile "Tools" -TestName "CloudFoundryCli"

View File

@@ -37,4 +37,6 @@ setx EdgeWebDriver "$EdgeDriverPath" /M
$regEnvKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\'
$PathValue = Get-ItemPropertyValue -Path $regEnvKey -Name 'Path'
$PathValue += ";$EdgeDriverPath\"
Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $PathValue
Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $PathValue
Invoke-PesterTests -TestFile "Browsers" -TestName "Edge"

View File

@@ -49,4 +49,6 @@ Extract-7Zip -Path $GeckoDriverArchPath -DestinationPath $GeckoDriverPath
Write-Host "Setting the environment variables..."
Add-MachinePathItem -PathItem $GeckoDriverPath
setx GeckoWebDriver "$GeckoDriverPath" /M
setx GeckoWebDriver "$GeckoDriverPath" /M
Invoke-PesterTests -TestFile "Browsers" -TestName "Firefox"

View File

@@ -40,4 +40,5 @@ Choco-Install -PackageName hub
Add-MachinePathItem "C:\Program Files\Git\bin"
exit 0
Invoke-PesterTests -TestFile "Git" -TestName "Git"
Invoke-PesterTests -TestFile "Git" -TestName "Hub"

View File

@@ -3,8 +3,8 @@
## Desc: Install GitHub CLI
################################################################################
Import-Module -Name ImageHelpers -Force
Choco-Install -PackageName gh
Add-MachinePathItem "C:\Program Files (x86)\GitHub CLI"
Add-MachinePathItem "C:\Program Files (x86)\GitHub CLI"
Invoke-PesterTests -TestFile "Tools" -TestName "GitHub-CLI"

View File

@@ -4,3 +4,5 @@
################################################################################
Choco-Install -PackageName gitversion.portable
Invoke-PesterTests -TestFile "Git" -TestName "GitVersion"

View File

@@ -7,3 +7,5 @@
$googleCloudSDKInstaller = "https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe"
$argumentList = @("/S", "/allusers", "/noreporting")
Install-Binary -Url $googleCloudSDKInstaller -Name "GoogleCloudSDKInstaller.exe" -ArgumentList $argumentList
Invoke-PesterTests -TestFile "Tools" -TestName "GoogleCouldSDK"

View File

@@ -22,3 +22,5 @@ Add-MachinePathItem -PathItem $DefaultGhcPath
Write-Host "Installing cabal..."
Choco-Install -PackageName cabal
Invoke-PesterTests -TestFile "Haskell"

View File

@@ -36,3 +36,5 @@ Write-Host "Get the IEDriver version..."
Write-Host "Setting the IEWebDriver environment variables"
setx IEWebDriver $ieDriverPath /M
Invoke-PesterTests -TestFile "Browsers" -TestName "Internet Explorer"

View File

@@ -4,3 +4,5 @@
################################################################################
Choco-Install -PackageName innosetup
Invoke-PesterTests -TestFile "Tools" -TestName "InnoSetup"

View File

@@ -4,3 +4,5 @@
################################################################################
Choco-Install -PackageName jq
Invoke-PesterTests -TestFile "Tools" -TestName "Jq"

View File

@@ -4,3 +4,5 @@
################################################################################
Choco-Install -PackageName julia -ArgumentList "--ia","/DIR=C:\Julia"
Invoke-PesterTests -TestFile "Tools" -TestName "Julia"

View File

@@ -5,3 +5,5 @@
Choco-Install -PackageName kubernetes-cli
Choco-Install -PackageName minikube
Invoke-PesterTests -TestFile "Tools" -TestName "KubernetesCli"

View File

@@ -8,3 +8,5 @@ Choco-Install -PackageName hg -ArgumentList "--version", "5.0.0"
$hgPath = "${env:ProgramFiles}\Mercurial\"
Add-MachinePathItem $hgPath
$env:Path = Get-MachinePath
Invoke-PesterTests -TestFile "Tools" -TestName "Mercurial"

View File

@@ -1,13 +1,13 @@
################################################################################
## File: Install-Mingw64.ps1
## Desc: Install GNU tools for Windows to C:\tools\mingw64
## Desc: Install GNU tools for Windows
################################################################################
Import-Module -Name ImageHelpers -Force
Choco-Install -PackageName mingw
# Make a copy of mingw32-make.exe to make.exe, which is a more discoverable name
# and so the same command line can be used on Windows as on macOS and Linux
$path = where.exe mingw32-make.exe | Get-Item
Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe')
Invoke-PesterTests -TestFile "Tools" -TestName "Mingw64"

View File

@@ -45,7 +45,6 @@ foreach ($tool in $tools) {
# Get github release asset for each version
foreach ($toolVersion in $tool.versions) {
$asset = $assets | Where-Object version -like $toolVersion `
| Sort-Object -Property {[version]$_.version} -Descending `
| Select-Object -ExpandProperty files `
| Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $tool.arch) -and ($_.toolset -eq $tool.toolset) } `
| Select-Object -First 1

View File

@@ -1,14 +0,0 @@
################################################################################
## File: Validate-Chrome.ps1
## Desc: Validate Google Chrome installation.
################################################################################
if (Test-Path 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe')
{
(Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo
}
else
{
Write-Host 'Google Chrome is not installed.'
exit 1
}

View File

@@ -1,15 +0,0 @@
################################################################################
## File: Validate-CloudFoundryCli.ps1
## Desc: Validate Cloud Foundry CLI
################################################################################
if (Get-Command -Name 'cf')
{
Write-Host 'cf on path'
}
else
{
Write-Host 'cf is not on path'
exit 1
}

View File

@@ -1,15 +0,0 @@
################################################################################
## File: Validate-Edge.ps1
## Desc: Validate Microsoft Edge installation.
################################################################################
$RegistryKey = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe"
if (Test-Path $RegistryKey)
{
(Get-Item (Get-ItemProperty $RegistryKey).'(Default)').VersionInfo
}
else
{
Write-Host "Microsoft Edge is not installed."
exit 1
}

View File

@@ -1,14 +0,0 @@
################################################################################
## File: Validate-Firefox.ps1
## Desc: Validate Mozilla Firefox installation.
################################################################################
if (Test-Path 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe')
{
(Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo
}
else
{
Write-Host 'Mozilla Firefox is not installed.'
exit 1
}

View File

@@ -1,20 +0,0 @@
################################################################################
## File: Validate-Git.ps1
## Desc: Validate Git for Windows
################################################################################
function Test-CommandName {
param(
[parameter(Mandatory)][string] $CommandName
)
Write-Host "Checking the [$CommandName]"
if(-not (Get-Command $CommandName -ErrorAction "Continue")) {
Write-Host "[!] $CommandName is not found"
exit 1
}
}
Test-CommandName -CommandName 'bash'
Test-CommandName -CommandName 'awk'
Test-CommandName -CommandName 'git'
Test-CommandName -CommandName 'git-lfs'
Test-CommandName -CommandName 'hub'

View File

@@ -1,14 +0,0 @@
################################################################################
## File: Validate-GitHub-CLI.ps1
## Desc: Validate GitHub CLI
################################################################################
if (Get-Command -Name 'gh')
{
Write-Host 'gh on path'
}
else
{
Write-Host 'gh is not on path'
exit 1
}

View File

@@ -1,14 +0,0 @@
################################################################################
## File: Validate-GitVersion.ps1
## Desc: Validate GitVersion
################################################################################
if (Get-Command -Name 'gitversion')
{
Write-Host 'gitversion on path'
}
else
{
Write-Host 'gitversion is not on path'
exit 1
}

View File

@@ -1,19 +0,0 @@
################################################################################
## File: Validate-GoogleCloudSDK.ps1
## Desc: Validate Install Google Cloud SDK for Windows
################################################################################
# Simple validation gcloud, gsutil, and bq command line tools
$validateTools = @("bq", "gcloud", "gsutil")
foreach($tool in $validateTools)
{
if (Get-Command -Name $tool)
{
Write-Host "$tool on path"
}
else
{
Write-Host "$tool is not on path"
exit 1
}
}

View File

@@ -1,55 +0,0 @@
################################################################################
## File: Validate-Haskell.ps1
## Desc: Validate Haskell for Windows
################################################################################
# GHC validation
if (Get-Command -Name 'ghc')
{
Write-Host "ghc is on the path"
}
else
{
Write-Host "ghc is not on path."
exit 1
}
$ChocoPackagesPath = Join-Path $env:ChocolateyInstall "lib"
[Array] $GhcVersionList = Get-ChildItem -Path $ChocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") }
# Validation that accurate 3 versions of GHC are installed
if ($GhcVersionList.Count -eq 3)
{
Write-Host "Versions of GHC are accurate"
}
else
{
Write-Host "Versions of GHC not accurate"
exit 1
}
# Validation each of GHC version
foreach ($version in $GhcVersionList)
{
$BinGhcPath = Join-Path $env:ChocolateyInstall "lib\ghc.$version\tools\ghc-$version\bin\ghc.exe"
if ((& $BinGhcPath --version) -match $version)
{
Write-Host "ghc $version is valid"
}
else
{
Write-Host "ghc $version is not valid"
exit 1
}
}
# Cabal validation
if (Get-Command -Name 'cabal')
{
Write-Host "cabal is on the path"
}
else
{
Write-Host "cabal is not on path."
exit 1
}

View File

@@ -1,15 +0,0 @@
################################################################################
## File: Validate-InnoSetup.ps1
## Desc: Validate Inno Setup
################################################################################
if (Get-Command -Name 'iscc')
{
Write-Host 'iscc is on PATH'
}
else
{
Write-Host 'iscc is not on PATH'
exit 1
}

View File

@@ -1,15 +0,0 @@
################################################################################
## File: Validate-Jq.ps1
## Desc: Validate jq
################################################################################
if (Get-Command -Name 'jq')
{
Write-Host 'jq on path'
}
else
{
Write-Host 'jq is not on path'
exit 1
}

View File

@@ -1,16 +0,0 @@
################################################################################
## File: Validate-Julia.ps1
## Desc: Validate Julia
################################################################################
# Verify that julia.exe is on the path
if ((Get-Command -Name 'julia') -and (Test-Path -Path 'C:\Julia'))
{
Write-Host "$(julia --version) is on the path."
}
else
{
Write-Host "Julia is not on the path."
exit 1
}

View File

@@ -1,25 +0,0 @@
################################################################################
## File: Validate-KubernetesCli.ps1
## Desc: Validate KubernetesCli.
################################################################################
if (Get-Command -Name 'kubectl')
{
Write-Host "kubectl $(kubectl version --client=true --short=true) in path"
}
else
{
Write-Host "kubectl is not in path"
exit 1
}
if (Get-Command -Name 'minikube')
{
Write-Host "minikube $(minikube version --short) in path"
}
else
{
Write-Host "minikube is not in path"
exit 1
}

View File

@@ -1,14 +0,0 @@
################################################################################
## File: Validate-Mercurial.ps1
## Desc: Validate Mercurial
################################################################################
if (Get-Command -Name 'hg')
{
Write-Host 'Mercurial on path'
}
else
{
Write-Host 'Mercurial is not on path'
exit 1
}

View File

@@ -1,37 +0,0 @@
################################################################################
## File: Validate-Mingw64.ps1
## Desc: Validate Mingw64
################################################################################
if (Get-Command -Name 'gcc')
{
Write-Host "gcc is successfully installed:"
gcc --version | Write-Host
}
else
{
Write-Host "gcc is not on PATH"
exit 1
}
if (Get-Command -Name 'g++')
{
Write-Host "g++ is successfully installed:"
g++ --version | Write-Host
}
else
{
Write-Host "g++ is not on PATH"
exit 1
}
if (Get-Command -Name 'make')
{
Write-Host "make is successfully installed:"
make --version | Write-Host
}
else
{
Write-Host "make is not on PATH"
exit 1
}

View File

@@ -1,38 +0,0 @@
################################################################################
## File: Validate-Chrome.ps1
## Desc: Validate Google Chrome installation.
################################################################################
$IEDriverPath = $env:IEWebDriver
Write-Host "IEDriverPath: $IEDriverPath"
$GeckoDriverPath = $env:GeckoWebDriver
Write-Host "GeckoDriverPath: $GeckoDriverPath"
$ChromeDriverPath = $env:ChromeWebDriver
Write-Host "ChromeDriverPath: $ChromeDriverPath"
$EdgeDriverPath = $env:EdgeWebDriver
Write-Host "EdgeDriverPath: $EdgeDriverPath"
if (
($IEDriverPath -like "C:\SeleniumWebDrivers\IEDriver") -and
($GeckoDriverPath -like "C:\SeleniumWebDrivers\GeckoDriver") -and
($ChromeDriverPath -like "C:\SeleniumWebDrivers\ChromeDriver") -and
($EdgeDriverPath -like "C:\SeleniumWebDrivers\EdgeDriver")
)
{
Write-Host "IEDriver installed at "
(Get-Item "$IEDriverPath\IEDriverServer.exe").VersionInfo
Write-Host "Gecko Driver installed at "
(Get-Item "$GeckoDriverPath\geckodriver.exe").VersionInfo
Write-Host "Chrome Driver installed at "
(Get-Item "$ChromeDriverPath\chromedriver.exe").VersionInfo
Write-Host "Edge Driver installed at "
(Get-Item "$EdgeDriverPath\msedgedriver.exe").VersionInfo
}
else
{
Write-Host "Selenium Web Drivers are not installed."
exit 1
}

View File

@@ -0,0 +1,136 @@
Describe "Chrome" {
Context "WebDriver" {
It "ChromeWebDriver environment variable and path exists" {
$env:ChromeWebDriver | Should -Not -BeNullOrEmpty
$env:ChromeWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\ChromeDriver"
$env:ChromeWebDriver | Should -Exist
}
It "chromedriver.exe is installed" {
"$env:ChromeWebDriver\chromedriver.exe --version" | Should -ReturnZeroExitCode
}
It "versioninfo.txt exists" {
"$env:ChromeWebDriver\versioninfo.txt" | Should -Exist
}
}
Context "Browser" {
$chromeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe"
It "Chrome '<chromeRegPath>' registry path exists" -TestCases @{chromeRegPath = $chromeRegPath} {
$chromeRegPath | Should -Exist
}
It "Chrome VersionInfo registry value exists" -TestCases @{chromeRegPath = $chromeRegPath} {
$versionInfo = (Get-Item (Get-ItemProperty $chromeRegPath).'(Default)').VersionInfo
$versionInfo | Should -Not -BeNullOrEmpty
}
It "gupdate service is stopped" {
$svc = Get-Service -Name gupdate
$svc.Status | Should -BeExactly Stopped
}
It "gupdatem service is stopped" {
$svc = Get-Service -Name gupdatem
$svc.Status | Should -BeExactly Stopped
}
It "BlockGoogleUpdate firewall rule exists" {
Get-NetFirewallRule -DisplayName BlockGoogleUpdate | Should -Not -BeNullOrEmpty
}
It "chrome.exe is installed" {
"${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe" | Should -Exist
}
}
}
Describe "Edge" {
Context "WebDriver" {
It "EdgeWebDriver environment variable and path exists" {
$env:EdgeWebDriver | Should -Not -BeNullOrEmpty
$env:EdgeWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\EdgeDriver"
$env:EdgeWebDriver | Should -Exist
}
It "msedgedriver.exe is installed" {
"$env:EdgeWebDriver\msedgedriver.exe --version" | Should -ReturnZeroExitCode
}
It "versioninfo.txt exists" {
"$env:EdgeWebDriver\versioninfo.txt" | Should -Exist
}
}
Context "Browser" {
$edgeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe"
It "Edge '<edgeRegPath>' registry path exists" -TestCases @{edgeRegPath = $edgeRegPath} {
$edgeRegPath | Should -Exist
}
It "Edge VersionInfo registry value exists" -TestCases @{edgeRegPath = $edgeRegPath} {
$versionInfo = (Get-Item (Get-ItemProperty $edgeRegPath).'(Default)').VersionInfo
$versionInfo | Should -Not -BeNullOrEmpty
}
It "msedge.exe is installed" {
"${env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe" | Should -Exist
}
}
}
Describe "Firefox" {
Context "WebDriver" {
It "GeckoWebDriver environment variable and path exists" {
$env:GeckoWebDriver | Should -Not -BeNullOrEmpty
$env:GeckoWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\GeckoDriver"
$env:GeckoWebDriver | Should -Exist
}
It "geckodriver.exe is installed" {
"$env:GeckoWebDriver\geckodriver.exe --version" | Should -ReturnZeroExitCode
}
It "versioninfo.txt exists" {
"$env:GeckoWebDriver\versioninfo.txt" | Should -Exist
}
}
Context "Browser" {
$firefoxRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe"
It "Firefox '<firefoxRegPath>' registry path exists" -TestCases @{firefoxRegPath = $firefoxRegPath} {
$firefoxRegPath | Should -Exist
}
It "Firefox VersionInfo registry value exists" -TestCases @{firefoxRegPath = $firefoxRegPath} {
$versionInfo = (Get-Item (Get-ItemProperty $firefoxRegPath).'(Default)').VersionInfo
$versionInfo | Should -Not -BeNullOrEmpty
}
It "firefox.exe is installed" {
"$env:ProgramFiles\Mozilla Firefox\firefox.exe" | Should -Exist
}
}
}
Describe "Internet Explorer" {
Context "WebDriver" {
It "IEWebDriver environment variable and path exists" {
$env:IEWebDriver | Should -Not -BeNullOrEmpty
$env:IEWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\IEDriver"
$env:IEWebDriver | Should -Exist
}
It "iedriverserver.exe is installed" {
"$env:IEWebDriver\IEDriverServer.exe --version" | Should -ReturnZeroExitCode
}
It "versioninfo.txt exists" {
"$env:IEWebDriver\versioninfo.txt" | Should -Exist
}
}
}

View File

@@ -0,0 +1,37 @@
Describe "Git" {
$gitTools = 'bash', 'awk', 'git', 'git-lfs'
$gitTestCases = $gitTools | ForEach-Object {
@{
toolName = $_
source = [regex]::Escape("$env:ProgramFiles\Git")
}
}
It "<toolName> is installed" -TestCases $gitTestCases {
"$toolName --version" | Should -ReturnZeroExitCode
}
It "<toolName> is located in '<source>'" -TestCases $gitTestCases {
(Get-Command -Name $toolName).Source | Should -Match $source
}
It "Git core.symlinks=true option is enabled" {
git config core.symlinks | Should -BeExactly true
}
It "GCM_INTERACTIVE environment variable should be equal Never" {
$env:GCM_INTERACTIVE | Should -BeExactly Never
}
}
Describe "Hub" {
It "hub is installed" {
"hub --version" | Should -ReturnZeroExitCode
}
}
Describe "GitVersion" {
It "gitversion is installed" {
"gitversion /version" | Should -ReturnZeroExitCode
}
}

View File

@@ -0,0 +1,30 @@
Describe "Haskell" {
$chocoPackagesPath = Join-Path $env:ChocolateyInstall "lib"
[array]$ghcVersionList = Get-ChildItem -Path $chocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") }
$ghcCount = $ghcVersionList.Count
$defaultGhcVersion = $ghcVersionList | Sort-Object {[Version]$_} | Select-Object -Last 1
$ghcTestCases = $ghcVersionList | ForEach-Object {
$ghcVersion = $_
@{
ghcVersion = $ghcVersion
binGhcPath = Join-Path $chocoPackagesPath "ghc.$ghcVersion\tools\ghc-$ghcVersion\bin\ghc.exe"
}
}
It "Accurate 3 versions of GHC are installed" -TestCases @{ghcCount = $ghcCount} {
$ghcCount | Should -BeExactly 3
}
It "GHC <ghcVersion> is installed" -TestCases $ghcTestCases {
"$binGhcPath --version" | Should -MatchCommandOutput $ghcVersion
}
It "GHC <defaultGhcVersion> is the default version and should be the latest installed" -TestCases @{defaultGhcVersion = $defaultGhcVersion} {
"ghc --version" | Should -MatchCommandOutput $defaultGhcVersion
}
It "Cabal is installed" {
"cabal --version" | Should -ReturnZeroExitCode
}
}

View File

@@ -20,4 +20,86 @@ Describe "DotnetTLS" {
It "Tls 1.2 is enabled" {
[Net.ServicePointManager]::SecurityProtocol -band "Tls12" | Should -Be Tls12
}
}
Describe "Jq" {
It "Jq" {
"jq -n ." | Should -ReturnZeroExitCode
}
}
Describe "Julia" {
It "Julia path exists" {
"C:\Julia" | Should -Exist
}
It "Julia" {
"julia --version" | Should -ReturnZeroExitCode
}
}
Describe "Mercurial" {
It "Mercurial" {
"hg --version" | Should -ReturnZeroExitCode
}
}
Describe "KubernetesCli" {
It "kubectl" {
"kubectl version --client=true --short=true" | Should -ReturnZeroExitCode
}
It "minikube" {
"minikube version --short" | Should -ReturnZeroExitCode
}
}
Describe "Mingw64" {
It "gcc" {
"gcc --version" | Should -ReturnZeroExitCode
}
It "g++" {
"g++ --version" | Should -ReturnZeroExitCode
}
It "make" {
"make --version" | Should -ReturnZeroExitCode
}
}
Describe "InnoSetup" {
It "InnoSetup" {
(Get-Command -Name iscc).CommandType | Should -BeExactly "Application"
}
}
Describe "GitHub-CLI" {
It "gh" {
"gh --version" | Should -ReturnZeroExitCode
}
}
Describe "CloudFoundryCli" {
It "cf is located in C:\cf-cli" {
"C:\cf-cli\cf.exe" | Should -Exist
}
It "cf" {
"cf --version" | Should -ReturnZeroExitCode
}
}
Describe "GoogleCouldSDK" {
It "bq" {
"bq version" | Should -ReturnZeroExitCode
}
It "gcloud" {
"gcloud version" | Should -ReturnZeroExitCode
}
It "gsutil" {
"gsutil version" | Should -ReturnZeroExitCode
}
}