From 781a4f8b38d3c04406ab8ca049f12a205b36ed0e Mon Sep 17 00:00:00 2001 From: Image generation service account Date: Tue, 7 Jul 2020 14:51:42 +0000 Subject: [PATCH 01/12] Updating readme file for win16 version 20200706.1 --- images/win/Windows2016-Readme.md | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/images/win/Windows2016-Readme.md b/images/win/Windows2016-Readme.md index dc064100..8a964907 100644 --- a/images/win/Windows2016-Readme.md +++ b/images/win/Windows2016-Readme.md @@ -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;
PGDATA=C:\Program Files\PostgreSQL\12\data;
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;
PGDATA=C:\Program Files\PostgreSQL\12\data;
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
1.6.0
2.3.2
2.6.0
3.1.0
3.5.0
3.8.0 | C:\Modules\az_\ | -| Azure | 2.1.0 [Installed]
3.8.0
4.2.1
5.1.1
5.3.0 | C:\Modules\azure_\ | -| AzureRM | 2.1.0 [Installed]
3.8.0
4.2.1
5.1.1
6.7.0
6.13.1 | C:\Modules\azurerm_\ | +| Module | Version | Path | +| ------- | -------------------------------------------------------------------- | ------------------------------ | +| Az | 1.0.0
1.6.0
2.3.2
2.6.0
3.1.0
3.5.0
3.8.0
4.3.0 | C:\Modules\az_\ | +| Azure | 2.1.0 [Installed]
3.8.0
4.2.1
5.1.1
5.3.0 | C:\Modules\azure_\ | +| AzureRM | 2.1.0 [Installed]
3.8.0
4.2.1
5.1.1
6.7.0
6.13.1 | C:\Modules\azurerm_\ | ``` Azure PowerShell module 2.1.0 and AzureRM PowerShell module 2.1.0 are installed and are available via 'Get-Module -ListAvailable'. From f1352d64d5b0e15d715e983c4a6577fd12349469 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Fri, 10 Jul 2020 14:29:54 +0300 Subject: [PATCH 02/12] Migration to Pester tests --- images/win/Windows2016-Azure.json | 96 ----------- images/win/Windows2019-Azure.json | 96 ----------- .../win/scripts/Installers/Install-Chrome.ps1 | 4 +- .../Installers/Install-CloudFoundryCli.ps1 | 4 +- .../win/scripts/Installers/Install-Edge.ps1 | 4 +- .../scripts/Installers/Install-Firefox.ps1 | 4 +- images/win/scripts/Installers/Install-Git.ps1 | 2 +- .../scripts/Installers/Install-GitHub-CLI.ps1 | 6 +- .../scripts/Installers/Install-GitVersion.ps1 | 2 + .../Installers/Install-GoogleCloudSDK.ps1 | 2 + .../scripts/Installers/Install-Haskell.ps1 | 2 + .../Installers/Install-IEWebDriver.ps1 | 2 + .../scripts/Installers/Install-InnoSetup.ps1 | 2 + images/win/scripts/Installers/Install-Jq.ps1 | 2 + .../win/scripts/Installers/Install-Julia.ps1 | 2 + .../Installers/Install-KubernetesCli.ps1 | 2 + .../scripts/Installers/Install-Mercurial.ps1 | 2 + .../scripts/Installers/Install-Mingw64.ps1 | 6 +- .../scripts/Installers/Validate-Chrome.ps1 | 14 -- .../Installers/Validate-CloudFoundryCli.ps1 | 15 -- .../win/scripts/Installers/Validate-Edge.ps1 | 15 -- .../scripts/Installers/Validate-Firefox.ps1 | 14 -- .../win/scripts/Installers/Validate-Git.ps1 | 20 --- .../Installers/Validate-GitHub-CLI.ps1 | 14 -- .../Installers/Validate-GitVersion.ps1 | 14 -- .../Installers/Validate-GoogleCloudSDK.ps1 | 19 --- .../scripts/Installers/Validate-Haskell.ps1 | 55 ------ .../scripts/Installers/Validate-InnoSetup.ps1 | 15 -- images/win/scripts/Installers/Validate-Jq.ps1 | 15 -- .../win/scripts/Installers/Validate-Julia.ps1 | 16 -- .../Installers/Validate-KubernetesCli.ps1 | 25 --- .../scripts/Installers/Validate-Mercurial.ps1 | 14 -- .../scripts/Installers/Validate-Mingw64.ps1 | 37 ---- .../Validate-SeleniumWebDrivers.ps1 | 38 ----- images/win/scripts/Tests/Browsers.Tests.ps1 | 160 ++++++++++++++++++ images/win/scripts/Tests/Git.Tests.ps1 | 35 ++++ images/win/scripts/Tests/Haskell.Test.ps1 | 33 ++++ images/win/scripts/Tests/Tools.Tests.ps1 | 86 ++++++++++ 38 files changed, 351 insertions(+), 543 deletions(-) delete mode 100644 images/win/scripts/Installers/Validate-Chrome.ps1 delete mode 100644 images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 delete mode 100644 images/win/scripts/Installers/Validate-Edge.ps1 delete mode 100644 images/win/scripts/Installers/Validate-Firefox.ps1 delete mode 100644 images/win/scripts/Installers/Validate-Git.ps1 delete mode 100644 images/win/scripts/Installers/Validate-GitHub-CLI.ps1 delete mode 100644 images/win/scripts/Installers/Validate-GitVersion.ps1 delete mode 100644 images/win/scripts/Installers/Validate-GoogleCloudSDK.ps1 delete mode 100644 images/win/scripts/Installers/Validate-Haskell.ps1 delete mode 100644 images/win/scripts/Installers/Validate-InnoSetup.ps1 delete mode 100644 images/win/scripts/Installers/Validate-Jq.ps1 delete mode 100644 images/win/scripts/Installers/Validate-Julia.ps1 delete mode 100644 images/win/scripts/Installers/Validate-KubernetesCli.ps1 delete mode 100644 images/win/scripts/Installers/Validate-Mercurial.ps1 delete mode 100644 images/win/scripts/Installers/Validate-Mingw64.ps1 delete mode 100644 images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 create mode 100644 images/win/scripts/Tests/Browsers.Tests.ps1 create mode 100644 images/win/scripts/Tests/Git.Tests.ps1 create mode 100644 images/win/scripts/Tests/Haskell.Test.ps1 diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 349591cd..8096a7c0 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -760,18 +760,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":[ @@ -784,12 +772,6 @@ "{{ template_dir }}/scripts/Installers/Validate-Rust.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Julia.ps1" - ] - }, { "type": "powershell", "scripts":[ @@ -802,30 +784,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":[ @@ -868,24 +826,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":[ @@ -910,48 +856,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":[ @@ -964,18 +880,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":[ diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 94a9a937..d45e2583 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -759,18 +759,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":[ @@ -783,12 +771,6 @@ "{{ template_dir }}/scripts/Installers/Validate-Rust.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Julia.ps1" - ] - }, { "type": "powershell", "scripts":[ @@ -801,30 +783,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":[ @@ -855,24 +813,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":[ @@ -897,48 +843,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":[ @@ -957,12 +873,6 @@ "{{ template_dir }}/scripts/Installers/Validate-VSWhere.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-KubernetesCli.ps1" - ] - }, { "type": "powershell", "scripts":[ @@ -975,12 +885,6 @@ "{{ template_dir }}/scripts/Installers/Validate-AliyunCli.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-GoogleCloudSDK.ps1" - ] - }, { "type": "powershell", "scripts":[ diff --git a/images/win/scripts/Installers/Install-Chrome.ps1 b/images/win/scripts/Installers/Install-Chrome.ps1 index f0eecc4c..5e1d6ae4 100644 --- a/images/win/scripts/Installers/Install-Chrome.ps1 +++ b/images/win/scripts/Installers/Install-Chrome.ps1 @@ -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 \ No newline at end of file +Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $PathValue + +Invoke-PesterTests -TestFile "Browsers" -TestName "Chrome" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 b/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 index 6f9ea886..8d6b44d6 100644 --- a/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 +++ b/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 @@ -20,4 +20,6 @@ Write-Host "Extracting cf cli..." Extract-7Zip -Path $CloudFoundryArchPath -DestinationPath $CloudFoundryCliPath # Add cf to path -Add-MachinePathItem $CloudFoundryCliPath \ No newline at end of file +Add-MachinePathItem $CloudFoundryCliPath + +Invoke-PesterTests -TestFile "Tools" -TestName "CloudFoundryCli" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Edge.ps1 b/images/win/scripts/Installers/Install-Edge.ps1 index 85b828fb..ebb7871b 100644 --- a/images/win/scripts/Installers/Install-Edge.ps1 +++ b/images/win/scripts/Installers/Install-Edge.ps1 @@ -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 \ No newline at end of file +Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $PathValue + +Invoke-PesterTests -TestFile "Browsers" -TestName "Edge" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Firefox.ps1 b/images/win/scripts/Installers/Install-Firefox.ps1 index 8817bf01..979a7b4b 100644 --- a/images/win/scripts/Installers/Install-Firefox.ps1 +++ b/images/win/scripts/Installers/Install-Firefox.ps1 @@ -49,4 +49,6 @@ Extract-7Zip -Path $GeckoDriverArchPath -DestinationPath $GeckoDriverPath Write-Host "Setting the environment variables..." Add-MachinePathItem -PathItem $GeckoDriverPath -setx GeckoWebDriver "$GeckoDriverPath" /M \ No newline at end of file +setx GeckoWebDriver "$GeckoDriverPath" /M + +Invoke-PesterTests -TestFile "Browsers" -TestName "Firefox" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index 460a2a1b..1537be80 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -40,4 +40,4 @@ Choco-Install -PackageName hub Add-MachinePathItem "C:\Program Files\Git\bin" -exit 0 +Invoke-PesterTests -TestFile "Git" -TestName "Git" diff --git a/images/win/scripts/Installers/Install-GitHub-CLI.ps1 b/images/win/scripts/Installers/Install-GitHub-CLI.ps1 index 5fb49887..98cc5149 100644 --- a/images/win/scripts/Installers/Install-GitHub-CLI.ps1 +++ b/images/win/scripts/Installers/Install-GitHub-CLI.ps1 @@ -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" \ No newline at end of file +Add-MachinePathItem "C:\Program Files (x86)\GitHub CLI" + +Invoke-PesterTests -TestFile "Tools" -TestName "GitHub-CLI" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-GitVersion.ps1 b/images/win/scripts/Installers/Install-GitVersion.ps1 index 1e27e49f..d59dd67e 100644 --- a/images/win/scripts/Installers/Install-GitVersion.ps1 +++ b/images/win/scripts/Installers/Install-GitVersion.ps1 @@ -4,3 +4,5 @@ ################################################################################ Choco-Install -PackageName gitversion.portable + +Invoke-PesterTests -TestFile "Git" -TestName "GitVersion" diff --git a/images/win/scripts/Installers/Install-GoogleCloudSDK.ps1 b/images/win/scripts/Installers/Install-GoogleCloudSDK.ps1 index eb75707f..7123e3e4 100644 --- a/images/win/scripts/Installers/Install-GoogleCloudSDK.ps1 +++ b/images/win/scripts/Installers/Install-GoogleCloudSDK.ps1 @@ -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" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Haskell.ps1 b/images/win/scripts/Installers/Install-Haskell.ps1 index 7f398a86..459b74a5 100644 --- a/images/win/scripts/Installers/Install-Haskell.ps1 +++ b/images/win/scripts/Installers/Install-Haskell.ps1 @@ -22,3 +22,5 @@ Add-MachinePathItem -PathItem $DefaultGhcPath Write-Host "Installing cabal..." Choco-Install -PackageName cabal + +Invoke-PesterTests -TestFile "Haskell" diff --git a/images/win/scripts/Installers/Install-IEWebDriver.ps1 b/images/win/scripts/Installers/Install-IEWebDriver.ps1 index e62b8ab6..79e9cf3a 100644 --- a/images/win/scripts/Installers/Install-IEWebDriver.ps1 +++ b/images/win/scripts/Installers/Install-IEWebDriver.ps1 @@ -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" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-InnoSetup.ps1 b/images/win/scripts/Installers/Install-InnoSetup.ps1 index 17f26962..0bbbc925 100644 --- a/images/win/scripts/Installers/Install-InnoSetup.ps1 +++ b/images/win/scripts/Installers/Install-InnoSetup.ps1 @@ -4,3 +4,5 @@ ################################################################################ Choco-Install -PackageName innosetup + +Invoke-PesterTests -TestFile "Tools" -TestName "InnoSetup" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Jq.ps1 b/images/win/scripts/Installers/Install-Jq.ps1 index 5a383d79..50a05a5f 100644 --- a/images/win/scripts/Installers/Install-Jq.ps1 +++ b/images/win/scripts/Installers/Install-Jq.ps1 @@ -4,3 +4,5 @@ ################################################################################ Choco-Install -PackageName jq + +Invoke-PesterTests -TestFile "Tools" -TestName "Jq" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Julia.ps1 b/images/win/scripts/Installers/Install-Julia.ps1 index 6677b5d1..c4432101 100644 --- a/images/win/scripts/Installers/Install-Julia.ps1 +++ b/images/win/scripts/Installers/Install-Julia.ps1 @@ -4,3 +4,5 @@ ################################################################################ Choco-Install -PackageName julia -ArgumentList "--ia","/DIR=C:\Julia" + +Invoke-PesterTests -TestFile "Tools" -TestName "Julia" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-KubernetesCli.ps1 b/images/win/scripts/Installers/Install-KubernetesCli.ps1 index e006f779..cf4b8a8f 100644 --- a/images/win/scripts/Installers/Install-KubernetesCli.ps1 +++ b/images/win/scripts/Installers/Install-KubernetesCli.ps1 @@ -5,3 +5,5 @@ Choco-Install -PackageName kubernetes-cli Choco-Install -PackageName minikube + +Invoke-PesterTests -TestFile "Tools" -TestName "KubernetesCli" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Mercurial.ps1 b/images/win/scripts/Installers/Install-Mercurial.ps1 index da820d1b..bcbab65c 100644 --- a/images/win/scripts/Installers/Install-Mercurial.ps1 +++ b/images/win/scripts/Installers/Install-Mercurial.ps1 @@ -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" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Mingw64.ps1 b/images/win/scripts/Installers/Install-Mingw64.ps1 index fcb8f781..b6c86048 100644 --- a/images/win/scripts/Installers/Install-Mingw64.ps1 +++ b/images/win/scripts/Installers/Install-Mingw64.ps1 @@ -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" diff --git a/images/win/scripts/Installers/Validate-Chrome.ps1 b/images/win/scripts/Installers/Validate-Chrome.ps1 deleted file mode 100644 index 0f94190b..00000000 --- a/images/win/scripts/Installers/Validate-Chrome.ps1 +++ /dev/null @@ -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 -} diff --git a/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 b/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 deleted file mode 100644 index 69928a46..00000000 --- a/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 +++ /dev/null @@ -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 -} - diff --git a/images/win/scripts/Installers/Validate-Edge.ps1 b/images/win/scripts/Installers/Validate-Edge.ps1 deleted file mode 100644 index 2db17fb9..00000000 --- a/images/win/scripts/Installers/Validate-Edge.ps1 +++ /dev/null @@ -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 -} diff --git a/images/win/scripts/Installers/Validate-Firefox.ps1 b/images/win/scripts/Installers/Validate-Firefox.ps1 deleted file mode 100644 index 1fa1852f..00000000 --- a/images/win/scripts/Installers/Validate-Firefox.ps1 +++ /dev/null @@ -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 -} diff --git a/images/win/scripts/Installers/Validate-Git.ps1 b/images/win/scripts/Installers/Validate-Git.ps1 deleted file mode 100644 index c74239a5..00000000 --- a/images/win/scripts/Installers/Validate-Git.ps1 +++ /dev/null @@ -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' diff --git a/images/win/scripts/Installers/Validate-GitHub-CLI.ps1 b/images/win/scripts/Installers/Validate-GitHub-CLI.ps1 deleted file mode 100644 index 39163139..00000000 --- a/images/win/scripts/Installers/Validate-GitHub-CLI.ps1 +++ /dev/null @@ -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 -} diff --git a/images/win/scripts/Installers/Validate-GitVersion.ps1 b/images/win/scripts/Installers/Validate-GitVersion.ps1 deleted file mode 100644 index b315cda5..00000000 --- a/images/win/scripts/Installers/Validate-GitVersion.ps1 +++ /dev/null @@ -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 -} diff --git a/images/win/scripts/Installers/Validate-GoogleCloudSDK.ps1 b/images/win/scripts/Installers/Validate-GoogleCloudSDK.ps1 deleted file mode 100644 index 6bc348f3..00000000 --- a/images/win/scripts/Installers/Validate-GoogleCloudSDK.ps1 +++ /dev/null @@ -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 - } -} diff --git a/images/win/scripts/Installers/Validate-Haskell.ps1 b/images/win/scripts/Installers/Validate-Haskell.ps1 deleted file mode 100644 index f64c7536..00000000 --- a/images/win/scripts/Installers/Validate-Haskell.ps1 +++ /dev/null @@ -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 -} diff --git a/images/win/scripts/Installers/Validate-InnoSetup.ps1 b/images/win/scripts/Installers/Validate-InnoSetup.ps1 deleted file mode 100644 index 21c55119..00000000 --- a/images/win/scripts/Installers/Validate-InnoSetup.ps1 +++ /dev/null @@ -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 -} - diff --git a/images/win/scripts/Installers/Validate-Jq.ps1 b/images/win/scripts/Installers/Validate-Jq.ps1 deleted file mode 100644 index 67b4275f..00000000 --- a/images/win/scripts/Installers/Validate-Jq.ps1 +++ /dev/null @@ -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 -} - diff --git a/images/win/scripts/Installers/Validate-Julia.ps1 b/images/win/scripts/Installers/Validate-Julia.ps1 deleted file mode 100644 index 94d02cfc..00000000 --- a/images/win/scripts/Installers/Validate-Julia.ps1 +++ /dev/null @@ -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 -} - diff --git a/images/win/scripts/Installers/Validate-KubernetesCli.ps1 b/images/win/scripts/Installers/Validate-KubernetesCli.ps1 deleted file mode 100644 index a51cbac6..00000000 --- a/images/win/scripts/Installers/Validate-KubernetesCli.ps1 +++ /dev/null @@ -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 -} - diff --git a/images/win/scripts/Installers/Validate-Mercurial.ps1 b/images/win/scripts/Installers/Validate-Mercurial.ps1 deleted file mode 100644 index d42189b8..00000000 --- a/images/win/scripts/Installers/Validate-Mercurial.ps1 +++ /dev/null @@ -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 -} diff --git a/images/win/scripts/Installers/Validate-Mingw64.ps1 b/images/win/scripts/Installers/Validate-Mingw64.ps1 deleted file mode 100644 index eb097ae7..00000000 --- a/images/win/scripts/Installers/Validate-Mingw64.ps1 +++ /dev/null @@ -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 -} diff --git a/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 b/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 deleted file mode 100644 index 7dd9529f..00000000 --- a/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 +++ /dev/null @@ -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 -} diff --git a/images/win/scripts/Tests/Browsers.Tests.ps1 b/images/win/scripts/Tests/Browsers.Tests.ps1 new file mode 100644 index 00000000..4a1fdb67 --- /dev/null +++ b/images/win/scripts/Tests/Browsers.Tests.ps1 @@ -0,0 +1,160 @@ +Describe "Chrome" { + Context "WebDriver" { + It "ChromeWebDriver environment variable exists" { + $env:ChromeWebDriver | Should -Not -BeNullOrEmpty + } + + It "ChromeWebDriver should be equal C:\SeleniumWebDrivers\ChromeDriver" { + $env:ChromeWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\ChromeDriver" + } + + It "ChromeWebDriver path exists" { + $env:ChromeWebDriver | Should -Exist + } + + It "chromedriver.exe exists" { + "$env:ChromeWebDriver\chromedriver.exe" | Should -Exist + } + + It "versioninfo.txt exists" { + "$env:ChromeWebDriver\versioninfo.txt" | Should -Exist + } + } + + Context "Chrome" { + $chromeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" + + It "$edgeRegPath 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 is stopped" { + $svc = Get-Service -Name gupdate + $svc.Status | Should -BeExactly Stopped + } + + It "gupdatem 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 exists" { + $env:EdgeWebDriver | Should -Not -BeNullOrEmpty + } + + It "EdgeWebDriver should be equal C:\SeleniumWebDrivers\EdgeDriver" { + $env:EdgeWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\EdgeDriver" + } + + It "EdgeWebDriver path exists" { + $env:EdgeWebDriver | Should -Exist + } + + It "msedgedriver.exe exists" { + "$env:EdgeWebDriver\msedgedriver.exe" | Should -Exist + } + + It "versioninfo.txt exists" { + "$env:EdgeWebDriver\versioninfo.txt" | Should -Exist + } + } + + Context "Firefox" { + $edgeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe" + + It "$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 "GeckoWebDriver" { + It "GeckoWebDriver environment variable exists" { + $env:GeckoWebDriver | Should -Not -BeNullOrEmpty + } + + It "GeckoWebDriver should be equal C:\SeleniumWebDrivers\GeckoDriver" { + $env:GeckoWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\GeckoDriver" + } + + It "GeckoWebDriver path exists" { + $env:GeckoWebDriver | Should -Exist + } + + It "geckodriver.exe exists" { + "$env:GeckoWebDriver\geckodriver.exe" | Should -Exist + } + + It "versioninfo.txt exists" { + "$env:GeckoWebDriver\versioninfo.txt" | Should -Exist + } + } + + Context "Firefox" { + $firefoxRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" + + It "$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 "IEWebDriver" { + It "IEWebDriver environment variable exists" { + $env:IEWebDriver | Should -Not -BeNullOrEmpty + } + + It "IEWebDriver should be equal C:\SeleniumWebDrivers\IEDriver" { + $env:IEWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\IEDriver" + } + + It "IEWebDriver path exists" { + $env:IEWebDriver | Should -Exist + } + + It "geckodriver.exe exists" { + "$env:IEWebDriver\IEDriverServer.exe" | Should -Exist + } + + It "versioninfo.txt exists" { + "$env:IEWebDriver\versioninfo.txt" | Should -Exist + } + } +} \ No newline at end of file diff --git a/images/win/scripts/Tests/Git.Tests.ps1 b/images/win/scripts/Tests/Git.Tests.ps1 new file mode 100644 index 00000000..a2db12d0 --- /dev/null +++ b/images/win/scripts/Tests/Git.Tests.ps1 @@ -0,0 +1,35 @@ +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 ''" -TestCases $gitTestCases { + (Get-Command -Name $toolName).Source | Should -Match $source + } + + It "hub is installed" { + "hub --version" | Should -ReturnZeroExitCode + } + + 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 "GitVersion" { + It "gitversion is installed" { + "gitversion /version" | Should -ReturnZeroExitCode + } +} \ No newline at end of file diff --git a/images/win/scripts/Tests/Haskell.Test.ps1 b/images/win/scripts/Tests/Haskell.Test.ps1 new file mode 100644 index 00000000..68de94a2 --- /dev/null +++ b/images/win/scripts/Tests/Haskell.Test.ps1 @@ -0,0 +1,33 @@ +Describe "Haskell" { + It "ghc" { + "ghc --version" | Should -ReturnZeroExitCode + } + + It "cabal" { + "cabal --version" | Should -ReturnZeroExitCode + } + + $chocoPackagesPath = Join-Path $env:ChocolateyInstall "lib" + [array]$ghcVersionList = Get-ChildItem -Path $chocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") } + $ghcCount = $ghcVersionList.Count + + It "Accurate 3 versions of GHC are installed" -TestCases @{ghcCount = $ghcCount} { + $ghcCount | Should -BeExactly 3 + } + + $ghcTestCases = $ghcVersionList | ForEach-Object { + @{ + ghcVersion = $_ + } + } + + It "Validation each of GHC version" -TestCases $ghcTestCases { + $binGhcPath = Join-Path $env:ChocolateyInstall "lib\ghc.$ghcVersion\tools\ghc-$ghcVersion\bin\ghc.exe" + & $binGhcPath --version | Should -Match $ghcVersion + } + + It "Default version of GHC should be the latest installed" { + $defaultGhcVersion = $ghcVersionList | Sort-Object {[Version]$_} |Select-Object -Last 1 + ghc --version | Should -Match $defaultGhcVersion + } +} \ No newline at end of file diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index 6ddbcb21..fde95d20 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -14,4 +14,90 @@ Describe "Kind" { It "Kind" { "kind version" | Should -ReturnZeroExitCode } +} + +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 is located in ${env:ProgramFiles(x86)}\GitHub CLI" { + "${env:ProgramFiles(x86)}\GitHub CLI\gh.exe" | Should -Exist + } + + 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 + } } \ No newline at end of file From 8608a1070efdfb080e59a7c2f9e4ce666d436e52 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Fri, 10 Jul 2020 14:47:17 +0300 Subject: [PATCH 03/12] Migration to Pester tests --- images/win/scripts/Tests/{Haskell.Test.ps1 => Haskell.Tests.ps1} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename images/win/scripts/Tests/{Haskell.Test.ps1 => Haskell.Tests.ps1} (100%) diff --git a/images/win/scripts/Tests/Haskell.Test.ps1 b/images/win/scripts/Tests/Haskell.Tests.ps1 similarity index 100% rename from images/win/scripts/Tests/Haskell.Test.ps1 rename to images/win/scripts/Tests/Haskell.Tests.ps1 From bd13391d6bd682880dc60e0aca55f88a57536215 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 13 Jul 2020 09:47:54 +0300 Subject: [PATCH 04/12] merge browser tests into one It --- images/win/scripts/Tests/Browsers.Tests.ps1 | 32 +++------------------ images/win/scripts/Tests/Tools.Tests.ps1 | 4 --- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/images/win/scripts/Tests/Browsers.Tests.ps1 b/images/win/scripts/Tests/Browsers.Tests.ps1 index 4a1fdb67..80e26f45 100644 --- a/images/win/scripts/Tests/Browsers.Tests.ps1 +++ b/images/win/scripts/Tests/Browsers.Tests.ps1 @@ -1,14 +1,8 @@ Describe "Chrome" { Context "WebDriver" { - It "ChromeWebDriver environment variable exists" { + It "ChromeWebDriver environment variable and path exists" { $env:ChromeWebDriver | Should -Not -BeNullOrEmpty - } - - It "ChromeWebDriver should be equal C:\SeleniumWebDrivers\ChromeDriver" { $env:ChromeWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\ChromeDriver" - } - - It "ChromeWebDriver path exists" { $env:ChromeWebDriver | Should -Exist } @@ -55,15 +49,9 @@ Describe "Chrome" { Describe "Edge" { Context "WebDriver" { - It "EdgeWebDriver environment variable exists" { + It "EdgeWebDriver environment variable and path exists" { $env:EdgeWebDriver | Should -Not -BeNullOrEmpty - } - - It "EdgeWebDriver should be equal C:\SeleniumWebDrivers\EdgeDriver" { $env:EdgeWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\EdgeDriver" - } - - It "EdgeWebDriver path exists" { $env:EdgeWebDriver | Should -Exist } @@ -96,15 +84,9 @@ Describe "Edge" { Describe "Firefox" { Context "GeckoWebDriver" { - It "GeckoWebDriver environment variable exists" { + It "GeckoWebDriver environment variable and path exists" { $env:GeckoWebDriver | Should -Not -BeNullOrEmpty - } - - It "GeckoWebDriver should be equal C:\SeleniumWebDrivers\GeckoDriver" { $env:GeckoWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\GeckoDriver" - } - - It "GeckoWebDriver path exists" { $env:GeckoWebDriver | Should -Exist } @@ -137,15 +119,9 @@ Describe "Firefox" { Describe "Internet Explorer" { Context "IEWebDriver" { - It "IEWebDriver environment variable exists" { + It "IEWebDriver environment variable and path exists" { $env:IEWebDriver | Should -Not -BeNullOrEmpty - } - - It "IEWebDriver should be equal C:\SeleniumWebDrivers\IEDriver" { $env:IEWebDriver | Should -BeExactly "C:\SeleniumWebDrivers\IEDriver" - } - - It "IEWebDriver path exists" { $env:IEWebDriver | Should -Exist } diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index fde95d20..16be04e7 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -69,10 +69,6 @@ Describe "InnoSetup" { } Describe "GitHub-CLI" { - It "gh is located in ${env:ProgramFiles(x86)}\GitHub CLI" { - "${env:ProgramFiles(x86)}\GitHub CLI\gh.exe" | Should -Exist - } - It "gh" { "gh --version" | Should -ReturnZeroExitCode } From 81865d867e046f1a402f18b08c28f8e120d343a0 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 13 Jul 2020 10:10:46 +0300 Subject: [PATCH 05/12] add webdriver tests --- images/win/scripts/Tests/Browsers.Tests.ps1 | 26 ++++++++++----------- images/win/scripts/Tests/Haskell.Tests.ps1 | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/images/win/scripts/Tests/Browsers.Tests.ps1 b/images/win/scripts/Tests/Browsers.Tests.ps1 index 80e26f45..55bae00f 100644 --- a/images/win/scripts/Tests/Browsers.Tests.ps1 +++ b/images/win/scripts/Tests/Browsers.Tests.ps1 @@ -6,8 +6,8 @@ Describe "Chrome" { $env:ChromeWebDriver | Should -Exist } - It "chromedriver.exe exists" { - "$env:ChromeWebDriver\chromedriver.exe" | Should -Exist + It "chromedriver.exe is installed" { + "$env:ChromeWebDriver\chromedriver.exe --version" | Should -ReturnZeroExitCode } It "versioninfo.txt exists" { @@ -15,7 +15,7 @@ Describe "Chrome" { } } - Context "Chrome" { + Context "Browser" { $chromeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" It "$edgeRegPath registry path exists" -TestCases @{chromeRegPath = $chromeRegPath} { @@ -55,8 +55,8 @@ Describe "Edge" { $env:EdgeWebDriver | Should -Exist } - It "msedgedriver.exe exists" { - "$env:EdgeWebDriver\msedgedriver.exe" | Should -Exist + It "msedgedriver.exe is installed" { + "$env:EdgeWebDriver\msedgedriver.exe --version" | Should -ReturnZeroExitCode } It "versioninfo.txt exists" { @@ -64,7 +64,7 @@ Describe "Edge" { } } - Context "Firefox" { + Context "Browser" { $edgeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe" It "$edgeRegPath registry path exists" -TestCases @{edgeRegPath = $edgeRegPath} { @@ -83,15 +83,15 @@ Describe "Edge" { } Describe "Firefox" { - Context "GeckoWebDriver" { + 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 exists" { - "$env:GeckoWebDriver\geckodriver.exe" | Should -Exist + It "geckodriver.exe is installed" { + "$env:GeckoWebDriver\geckodriver.exe --version" | Should -ReturnZeroExitCode } It "versioninfo.txt exists" { @@ -99,7 +99,7 @@ Describe "Firefox" { } } - Context "Firefox" { + Context "Browser" { $firefoxRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" It "$firefoxRegPath registry path exists" -TestCases @{firefoxRegPath = $firefoxRegPath} { @@ -118,15 +118,15 @@ Describe "Firefox" { } Describe "Internet Explorer" { - Context "IEWebDriver" { + 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 "geckodriver.exe exists" { - "$env:IEWebDriver\IEDriverServer.exe" | Should -Exist + It "iedriverserver.exe is intalled" { + "$env:IEWebDriver\IEDriverServer.exe --version" | Should -ReturnZeroExitCode } It "versioninfo.txt exists" { diff --git a/images/win/scripts/Tests/Haskell.Tests.ps1 b/images/win/scripts/Tests/Haskell.Tests.ps1 index 68de94a2..b421b022 100644 --- a/images/win/scripts/Tests/Haskell.Tests.ps1 +++ b/images/win/scripts/Tests/Haskell.Tests.ps1 @@ -21,12 +21,12 @@ Describe "Haskell" { } } - It "Validation each of GHC version" -TestCases $ghcTestCases { + It " is installed" -TestCases $ghcTestCases { $binGhcPath = Join-Path $env:ChocolateyInstall "lib\ghc.$ghcVersion\tools\ghc-$ghcVersion\bin\ghc.exe" & $binGhcPath --version | Should -Match $ghcVersion } - It "Default version of GHC should be the latest installed" { + It "Default version of GHC should be the latest installed" -TestCases @{ghcVersionList = $ghcVersionList} { $defaultGhcVersion = $ghcVersionList | Sort-Object {[Version]$_} |Select-Object -Last 1 ghc --version | Should -Match $defaultGhcVersion } From f8bf39d9ad788dcf30c9f4ad9c59268b04f54768 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 13 Jul 2020 11:44:04 +0300 Subject: [PATCH 06/12] fixed browser tests --- images/win/scripts/Tests/Browsers.Tests.ps1 | 8 ++--- images/win/scripts/Tests/Git.Tests.ps1 | 2 +- images/win/scripts/Tests/Haskell.Tests.ps1 | 33 ++++++++++----------- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/images/win/scripts/Tests/Browsers.Tests.ps1 b/images/win/scripts/Tests/Browsers.Tests.ps1 index 55bae00f..6a50af09 100644 --- a/images/win/scripts/Tests/Browsers.Tests.ps1 +++ b/images/win/scripts/Tests/Browsers.Tests.ps1 @@ -18,7 +18,7 @@ Describe "Chrome" { Context "Browser" { $chromeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" - It "$edgeRegPath registry path exists" -TestCases @{chromeRegPath = $chromeRegPath} { + It "Chrome registry path exists" -TestCases @{chromeRegPath = $chromeRegPath} { $chromeRegPath | Should -Exist } @@ -67,7 +67,7 @@ Describe "Edge" { Context "Browser" { $edgeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe" - It "$edgeRegPath registry path exists" -TestCases @{edgeRegPath = $edgeRegPath} { + It "Edge registry path exists" -TestCases @{edgeRegPath = $edgeRegPath} { $edgeRegPath | Should -Exist } @@ -102,7 +102,7 @@ Describe "Firefox" { Context "Browser" { $firefoxRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" - It "$firefoxRegPath registry path exists" -TestCases @{firefoxRegPath = $firefoxRegPath} { + It "Firefox registry path exists" -TestCases @{firefoxRegPath = $firefoxRegPath} { $firefoxRegPath | Should -Exist } @@ -125,7 +125,7 @@ Describe "Internet Explorer" { $env:IEWebDriver | Should -Exist } - It "iedriverserver.exe is intalled" { + It "iedriverserver.exe is installed" { "$env:IEWebDriver\IEDriverServer.exe --version" | Should -ReturnZeroExitCode } diff --git a/images/win/scripts/Tests/Git.Tests.ps1 b/images/win/scripts/Tests/Git.Tests.ps1 index a2db12d0..88c6f039 100644 --- a/images/win/scripts/Tests/Git.Tests.ps1 +++ b/images/win/scripts/Tests/Git.Tests.ps1 @@ -15,7 +15,7 @@ Describe "Git" { (Get-Command -Name $toolName).Source | Should -Match $source } - It "hub is installed" { + It "ToolName 'hub' is installed" { "hub --version" | Should -ReturnZeroExitCode } diff --git a/images/win/scripts/Tests/Haskell.Tests.ps1 b/images/win/scripts/Tests/Haskell.Tests.ps1 index b421b022..99780a55 100644 --- a/images/win/scripts/Tests/Haskell.Tests.ps1 +++ b/images/win/scripts/Tests/Haskell.Tests.ps1 @@ -1,33 +1,30 @@ Describe "Haskell" { - It "ghc" { - "ghc --version" | Should -ReturnZeroExitCode - } - - It "cabal" { - "cabal --version" | Should -ReturnZeroExitCode - } - $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 } - $ghcTestCases = $ghcVersionList | ForEach-Object { - @{ - ghcVersion = $_ - } - } - - It " is installed" -TestCases $ghcTestCases { - $binGhcPath = Join-Path $env:ChocolateyInstall "lib\ghc.$ghcVersion\tools\ghc-$ghcVersion\bin\ghc.exe" + It "GHC is installed" -TestCases $ghcTestCases { & $binGhcPath --version | Should -Match $ghcVersion } - It "Default version of GHC should be the latest installed" -TestCases @{ghcVersionList = $ghcVersionList} { - $defaultGhcVersion = $ghcVersionList | Sort-Object {[Version]$_} |Select-Object -Last 1 + It "GHC is the default version and should be the latest installed" -TestCases @{defaultGhcVersion = $defaultGhcVersion} { ghc --version | Should -Match $defaultGhcVersion } + + It "Cabal is installed" { + "cabal --version" | Should -ReturnZeroExitCode + } } \ No newline at end of file From ea539f15cfc458dc505e5e912d6eae323febb33e Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 13 Jul 2020 12:17:14 +0300 Subject: [PATCH 07/12] fixed haskell tests --- images/win/scripts/Tests/Git.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/images/win/scripts/Tests/Git.Tests.ps1 b/images/win/scripts/Tests/Git.Tests.ps1 index 88c6f039..8c52db83 100644 --- a/images/win/scripts/Tests/Git.Tests.ps1 +++ b/images/win/scripts/Tests/Git.Tests.ps1 @@ -7,15 +7,15 @@ Describe "Git" { } } - It "Toolname '' is installed" -TestCases $gitTestCases { + It " is installed" -TestCases $gitTestCases { "$toolName --version" | Should -ReturnZeroExitCode } - It "ToolName '' is located in ''" -TestCases $gitTestCases { + It " is located in ''" -TestCases $gitTestCases { (Get-Command -Name $toolName).Source | Should -Match $source } - It "ToolName 'hub' is installed" { + It "hub is installed" { "hub --version" | Should -ReturnZeroExitCode } From 51da94d189399f533dd697a5ffa1891a39664890 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 13 Jul 2020 12:22:20 +0300 Subject: [PATCH 08/12] fix git tests --- images/win/scripts/Tests/Browsers.Tests.ps1 | 4 ++-- images/win/scripts/Tests/Git.Tests.ps1 | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/images/win/scripts/Tests/Browsers.Tests.ps1 b/images/win/scripts/Tests/Browsers.Tests.ps1 index 6a50af09..a04423d8 100644 --- a/images/win/scripts/Tests/Browsers.Tests.ps1 +++ b/images/win/scripts/Tests/Browsers.Tests.ps1 @@ -27,12 +27,12 @@ Describe "Chrome" { $versionInfo | Should -Not -BeNullOrEmpty } - It "gupdate is stopped" { + It "gupdate service is stopped" { $svc = Get-Service -Name gupdate $svc.Status | Should -BeExactly Stopped } - It "gupdatem is stopped" { + It "gupdatem service is stopped" { $svc = Get-Service -Name gupdatem $svc.Status | Should -BeExactly Stopped } diff --git a/images/win/scripts/Tests/Git.Tests.ps1 b/images/win/scripts/Tests/Git.Tests.ps1 index 8c52db83..97100e78 100644 --- a/images/win/scripts/Tests/Git.Tests.ps1 +++ b/images/win/scripts/Tests/Git.Tests.ps1 @@ -15,10 +15,6 @@ Describe "Git" { (Get-Command -Name $toolName).Source | Should -Match $source } - It "hub is installed" { - "hub --version" | Should -ReturnZeroExitCode - } - It "Git core.symlinks=true option is enabled" { git config core.symlinks | Should -BeExactly true } @@ -28,6 +24,12 @@ Describe "Git" { } } +Describe "Hub" { + It "hub is installed" { + "hub --version" | Should -ReturnZeroExitCode + } +} + Describe "GitVersion" { It "gitversion is installed" { "gitversion /version" | Should -ReturnZeroExitCode From 3356fa7bd048af4a71a1e314117dba179e794c8a Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 13 Jul 2020 13:37:04 +0300 Subject: [PATCH 09/12] add assert MatchCommandOutput --- .../win/scripts/ImageHelpers/TestsHelpers.ps1 | 33 +++++++++++++++++++ images/win/scripts/Installers/Install-Git.ps1 | 1 + images/win/scripts/Tests/Haskell.Tests.ps1 | 4 +-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/ImageHelpers/TestsHelpers.ps1 b/images/win/scripts/ImageHelpers/TestsHelpers.ps1 index 7a0229ac..ae3e1074 100644 --- a/images/win/scripts/ImageHelpers/TestsHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/TestsHelpers.ps1 @@ -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} } \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index 1537be80..25ce857d 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -41,3 +41,4 @@ Choco-Install -PackageName hub Add-MachinePathItem "C:\Program Files\Git\bin" Invoke-PesterTests -TestFile "Git" -TestName "Git" +Invoke-PesterTests -TestFile "Git" -TestName "Hub" diff --git a/images/win/scripts/Tests/Haskell.Tests.ps1 b/images/win/scripts/Tests/Haskell.Tests.ps1 index 99780a55..b6ebb763 100644 --- a/images/win/scripts/Tests/Haskell.Tests.ps1 +++ b/images/win/scripts/Tests/Haskell.Tests.ps1 @@ -17,11 +17,11 @@ Describe "Haskell" { } It "GHC is installed" -TestCases $ghcTestCases { - & $binGhcPath --version | Should -Match $ghcVersion + "$binGhcPath --version" | Should -MatchCommandOutput $ghcVersion } It "GHC is the default version and should be the latest installed" -TestCases @{defaultGhcVersion = $defaultGhcVersion} { - ghc --version | Should -Match $defaultGhcVersion + "ghc --version" | Should -MatchCommandOutput $defaultGhcVersion } It "Cabal is installed" { From 7efaab60f92aef19f2220a28745d3a5133193915 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 13 Jul 2020 14:42:40 +0300 Subject: [PATCH 10/12] format style --- images/win/scripts/ImageHelpers/TestsHelpers.ps1 | 4 ++-- images/win/scripts/Tests/Browsers.Tests.ps1 | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/images/win/scripts/ImageHelpers/TestsHelpers.ps1 b/images/win/scripts/ImageHelpers/TestsHelpers.ps1 index ae3e1074..5228492b 100644 --- a/images/win/scripts/ImageHelpers/TestsHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/TestsHelpers.ps1 @@ -110,10 +110,10 @@ function ShouldMatchCommandOutput { if (-not $succeeded) { if ($Negate) { - $failureMessage = "Expected regular expression '$RegularExpression' for '$ActualValue' command to not match '$output',but it did match." + $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." + $failureMessage = "Expected regular expression '$RegularExpression' for '$ActualValue' command to match '$output', but it did not match." } } diff --git a/images/win/scripts/Tests/Browsers.Tests.ps1 b/images/win/scripts/Tests/Browsers.Tests.ps1 index a04423d8..5f687090 100644 --- a/images/win/scripts/Tests/Browsers.Tests.ps1 +++ b/images/win/scripts/Tests/Browsers.Tests.ps1 @@ -18,7 +18,7 @@ Describe "Chrome" { Context "Browser" { $chromeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" - It "Chrome registry path exists" -TestCases @{chromeRegPath = $chromeRegPath} { + It "Chrome '' registry path exists" -TestCases @{chromeRegPath = $chromeRegPath} { $chromeRegPath | Should -Exist } @@ -67,7 +67,7 @@ Describe "Edge" { Context "Browser" { $edgeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe" - It "Edge registry path exists" -TestCases @{edgeRegPath = $edgeRegPath} { + It "Edge '' registry path exists" -TestCases @{edgeRegPath = $edgeRegPath} { $edgeRegPath | Should -Exist } @@ -102,7 +102,7 @@ Describe "Firefox" { Context "Browser" { $firefoxRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" - It "Firefox registry path exists" -TestCases @{firefoxRegPath = $firefoxRegPath} { + It "Firefox '' registry path exists" -TestCases @{firefoxRegPath = $firefoxRegPath} { $firefoxRegPath | Should -Exist } From aef9e7276de47e1aa14135c768b80261749a11ae Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Mon, 13 Jul 2020 17:46:36 +0300 Subject: [PATCH 11/12] Update Install-Toolset.ps1 --- images/win/scripts/Installers/Install-Toolset.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/images/win/scripts/Installers/Install-Toolset.ps1 b/images/win/scripts/Installers/Install-Toolset.ps1 index cc0a0aa7..42cdbaf2 100644 --- a/images/win/scripts/Installers/Install-Toolset.ps1 +++ b/images/win/scripts/Installers/Install-Toolset.ps1 @@ -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 From 363160a807b562ec224641a8c1e9429d96f37c86 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 14 Jul 2020 13:26:26 +0500 Subject: [PATCH 12/12] Fix StartCode/EndCode markup (#1213) Co-authored-by: Sergey Dolin --- images/linux/scripts/helpers/document.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/linux/scripts/helpers/document.sh b/images/linux/scripts/helpers/document.sh index 9f6830ef..0e1793a4 100644 --- a/images/linux/scripts/helpers/document.sh +++ b/images/linux/scripts/helpers/document.sh @@ -34,9 +34,9 @@ function AddBlockquote { } function StartCode { - WriteItem "``````" + WriteItem '```' } function EndCode { - WriteItem "``````" + WriteItem '```' }