Replace current validates with pester testing approach #3 (#1230)

* Pester Tests Approach implementation.

* changes for netPath
This commit is contained in:
Darii Nurgaleev
2020-07-17 15:29:03 +07:00
committed by GitHub
parent 4b271d3303
commit b47ba413c9
31 changed files with 146 additions and 440 deletions

View File

@@ -5,4 +5,10 @@ Describe "MongoDB" {
) {
"$ToolName --version" | Should -ReturnZeroExitCode
}
}
}
Describe "MySQL" {
It "MySQL CLI" {
"mysql -V" | Should -ReturnZeroExitCode
}
}

View File

@@ -0,0 +1,22 @@
BeforeAll {
$msys2BinDir = "C:\msys64\usr\bin"
$msys2mingwDir = "C:\msys64\mingw64\bin"
}
Describe "MSYS2" {
It "<ToolName>" -TestCases @(
@{ ToolName = "bash.exe" }
@{ ToolName = "tar.exe" }
@{ ToolName = "make.exe" }
) {
Join-Path $msys2BinDir $ToolName | Should -Exist
}
It "<ToolName>" -TestCases @(
@{ ToolName = "gcc.exe" }
@{ ToolName = "cmake.exe" }
@{ ToolName = "g++.exe" }
) {
Join-Path $msys2mingwDir $ToolName | Should -Exist
}
}

View File

@@ -0,0 +1,14 @@
Describe "Miniconda" {
It "Miniconda Environment variables is set. " {
${env:CONDA} | Should -Not -BeNullOrEmpty
}
It "Miniconda $env:CONDA\<PathTest> " -TestCases @(
@{ PathTest = "python.exe" }
@{ PathTest = "Scripts\conda.exe" }
) {
$condaPath = Join-Path ${env:CONDA} $PathTest
$condaPath | Should -Exist
"$condaPath --version" | Should -ReturnZeroExitCode
}
}

View File

@@ -0,0 +1,21 @@
Describe "Node.JS" {
Context "Basic modules"{
It "<ToolName> " -TestCases @(
@{ ToolName = "node" }
@{ ToolName = "npm" }
) {
"$ToolName --version" | Should -ReturnZeroExitCode
}
}
Context "Global NPM Packages" {
It "<ToolName> " -TestCases @(
@{ ToolName = "gulp" }
@{ ToolName = "grunt" }
@{ ToolName = "yarn" }
@{ ToolName = "lerna" }
@{ ToolName = "newman" }
) {
"$ToolName --version" | Should -ReturnZeroExitCode
}
}
}

View File

@@ -0,0 +1,13 @@
Describe "PHP" {
It "Check <ToolName> in the PATH" -TestCases @(
@{ ToolName = "php" }
@{ ToolName = "composer" }
) {
"$ToolName --version" | Should -ReturnZeroExitCode
}
It "PHP Environment variables is set." {
${env:PHPROOT} | Should -Not -BeNullOrEmpty
${env:PHPROOT} | Should -Exist
}
}

View File

@@ -1,3 +1,5 @@
Import-Module (Join-Path $PSScriptRoot "..\SoftwareReport\SoftwareReport.Common.psm1") -DisableNameChecking
Describe "7-Zip" {
It "7z" {
"7z" | Should -ReturnZeroExitCode
@@ -55,16 +57,12 @@ Describe "KubernetesCli" {
}
Describe "Mingw64" {
It "gcc" {
"gcc --version" | Should -ReturnZeroExitCode
}
It "g++" {
"g++ --version" | Should -ReturnZeroExitCode
}
It "make" {
"make --version" | Should -ReturnZeroExitCode
It "<ToolName>" -TestCases @(
@{ ToolName = "gcc" }
@{ ToolName = "g++" }
@{ ToolName = "make" }
) {
"$ToolName --version" | Should -ReturnZeroExitCode
}
}
@@ -90,16 +88,49 @@ Describe "CloudFoundryCli" {
}
}
Describe "GoogleCouldSDK" {
It "bq" {
"bq version" | Should -ReturnZeroExitCode
Describe "GoogleCouldSDK" {
It "<ToolName>" -TestCases @(
@{ ToolName = "bq" }
@{ ToolName = "gcloud" }
@{ ToolName = "gsutil" }
) {
"$ToolName version" | Should -ReturnZeroExitCode
}
}
It "gcloud" {
"gcloud version" | Should -ReturnZeroExitCode
Describe "NET48" {
It "NET48" {
$netPath = (Get-DotnetFrameworkTools).Path.Split("<")[0]
${netPath} + "4.8 Tools" | Should -Exist
}
}
It "gsutil" {
"gsutil version" | Should -ReturnZeroExitCode
Describe "NSIS" {
It "NSIS" {
"makensis /VERSION" | Should -ReturnZeroExitCode
}
}
Describe "Nuget" {
It "Nuget" {
"nuget" | Should -ReturnZeroExitCode
}
}
Describe "OpenSSL" {
It "OpenSSL" {
"openssl version" | Should -ReturnZeroExitCode
}
}
Describe "Packer" {
It "Packer" {
"packer --version" | Should -ReturnZeroExitCode
}
}
Describe "Perl" {
It "Perl" {
"perl --version" | Should -ReturnZeroExitCode
}
}