[Windows] Disable mongodb service by default (#6023)

* Disable mongodb service by default

* Add ErrorAction Ignore
This commit is contained in:
Aleksandr Chebotov
2022-08-05 20:50:37 +02:00
committed by GitHub
parent 58ba4559eb
commit f1bb031e43
2 changed files with 34 additions and 7 deletions

View File

@@ -1,10 +1,29 @@
Describe "MongoDB" {
It "<ToolName>" -TestCases @(
@{ ToolName = "mongo" }
@{ ToolName = "mongod" }
) {
$toolsetVersion = (Get-ToolsetContent).mongodb.version
(&$ToolName --version)[2].Split('"')[-2] | Should -BeLike "$toolsetVersion*"
Context "Version" {
It "<ToolName>" -TestCases @(
@{ ToolName = "mongo" }
@{ ToolName = "mongod" }
) {
$toolsetVersion = (Get-ToolsetContent).mongodb.version
(&$ToolName --version)[2].Split('"')[-2] | Should -BeLike "$toolsetVersion*"
}
}
Context "Service" {
$mongoService = Get-Service -Name mongodb -ErrorAction Ignore
$mongoServiceTests = @{
Name = $mongoService.Name
Status = $mongoService.Status
StartType = $mongoService.StartType
}
It "<Name> service is stopped" -TestCases $mongoServiceTests {
$Status | Should -Be "Stopped"
}
It "<Name> service is disabled" -TestCases $mongoServiceTests {
$StartType | Should -Be "Disabled"
}
}
}