Replace current validates with pester testing approach #5 (#1232)

* ,oving to the pester approach part #5

* moving to the pester approach part #5

* fixed PostgreSQL tests

* return Validate-Svn.ps1

* fixed Selenium test

* fixed rust test

* fix rust test
This commit is contained in:
Aleksandr Chebotov
2020-07-20 18:57:00 +03:00
committed by GitHub
parent 956b8a0093
commit 0c4dca229d
18 changed files with 145 additions and 161 deletions

View File

@@ -133,4 +133,18 @@ Describe "Internet Explorer" {
"$env:IEWebDriver\versioninfo.txt" | Should -Exist
}
}
}
Describe "Selenium" {
It "Selenium 'C:\selenium' path exists" {
"C:\selenium" | Should -Exist
}
It "Selenium Server 'selenium-server-standalone.jar' is installed" {
"C:\selenium\selenium-server-standalone.jar" | Should -Exist
}
It "SELENIUM_JAR_PATH environment variable exists" {
Get-EnvironmentVariable "SELENIUM_JAR_PATH" | Should -BeExactly "C:\selenium\selenium-server-standalone.jar"
}
}

View File

@@ -6,9 +6,55 @@ Describe "MongoDB" {
"$ToolName --version" | Should -ReturnZeroExitCode
}
}
Describe "PostgreSQL" {
$psqlTests = @(
@{envVar = "PGROOT"; pgPath = Get-EnvironmentVariable "PGROOT"}
@{envVar = "PGBIN"; pgPath = Get-EnvironmentVariable "PGBIN"}
@{envVar = "PGDATA"; pgPath = Get-EnvironmentVariable "PGDATA"}
)
Context "Environment variable" {
It "PGUSER contains postgres" {
Get-EnvironmentVariable "PGUSER" | Should -Be "postgres"
}
It "PGPASSWORD contains root" {
Get-EnvironmentVariable "PGPASSWORD" | Should -Be "root"
}
It "<envVar> environment variable exists" -TestCases $psqlTests {
Get-EnvironmentVariable $envVar | Should -Not -BeNullOrEmpty
}
}
Context "Path" {
It "<pgPath> path exists" -TestCases $psqlTests {
$pgPath | Should -Exist
}
}
Context "Service" {
$psqlService = Get-Service -Name postgresql*
$psqlServiceTests = @{
Name = $psqlService.Name
Status = $psqlService.Status
StartType = $psqlService.StartType
}
It "<Name> service is stopped" -TestCases $psqlServiceTests {
$Status | Should -Be "Stopped"
}
It "<Name> service is disabled" -TestCases $psqlServiceTests {
$StartType | Should -Be "Disabled"
}
}
}
Describe "MySQL" {
It "MySQL CLI" {
"mysql -V" | Should -ReturnZeroExitCode
}
}
}

View File

@@ -0,0 +1,27 @@
Describe "Rust" {
$rustTools = @(
@{ToolName = "rustup"; binPath = "C:\Rust\.cargo\bin\rustup.exe"}
@{ToolName = "rustc"; binPath = "C:\Rust\.cargo\bin\rustc.exe"}
@{ToolName = "cargo"; binPath = "C:\Rust\.cargo\bin\cargo.exe"}
@{ToolName = "cargo audit"; binPath = "C:\Rust\.cargo\bin\cargo-audit.exe"}
@{ToolName = "cargo outdated"; binPath = "C:\Rust\.cargo\bin\cargo-outdated.exe"}
)
$rustEnvNotExists = @(
@{envVar = "RUSTUP_HOME"}
@{envVar = "CARGO_HOME"}
)
It "C:\Rust\.rustup and C:\Rust\.cargo folders exist" {
"C:\Rust\.rustup", "C:\Rust\.cargo" | Should -Exist
}
It "<envVar> environment variable does not exist" -TestCases $rustEnvNotExists {
[Environment]::GetEnvironmentVariables("Machine").ContainsKey($envVar) | Should -BeFalse
}
It "<ToolName> is installed to the '<binPath>' folder" -TestCases $rustTools {
"$ToolName --version" | Should -ReturnZeroExitCode
$binPath | Should -Exist
}
}

View File

@@ -133,4 +133,26 @@ Describe "Perl" {
It "Perl" {
"perl --version" | Should -ReturnZeroExitCode
}
}
Describe "PowerShell Core" {
It "pwsh" {
"pwsh --version" | Should -ReturnZeroExitCode
}
It "Execute 2+2 command" {
pwsh -Command "2+2" | Should -BeExactly 4
}
}
Describe "Sbt" {
It "sbt" {
"sbt --version" | Should -ReturnZeroExitCode
}
}
Describe "ServiceFabricSDK" {
It "PowerShell Module" {
Get-Module -Name ServiceFabric -ListAvailable | Should -Not -BeNullOrEmpty
}
}