mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[Windows] Unify services handling (#8871)
* [Windows] Unify services handling * Fix Set-Service usage
This commit is contained in:
committed by
GitHub
parent
6efbc46fc7
commit
79c347765a
@@ -26,17 +26,16 @@ Install-Binary `
|
||||
-ExpectedSignature (Get-ToolsetContent).mongodb.signature
|
||||
|
||||
# Add mongodb to the PATH
|
||||
$mongodbService = "mongodb"
|
||||
$mongoPath = (Get-CimInstance Win32_Service -Filter "Name LIKE '$mongodbService'").PathName
|
||||
$mongoPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'mongodb'").PathName
|
||||
$mongoBin = Split-Path -Path $mongoPath.split('"')[1]
|
||||
Add-MachinePathItem "$mongoBin"
|
||||
|
||||
# Wait for mongodb service running
|
||||
$svc = Get-Service $mongodbService
|
||||
$svc.WaitForStatus('Running','00:01:00')
|
||||
$mongodbService = Get-Service "mongodb"
|
||||
$mongodbService.WaitForStatus('Running', '00:01:00')
|
||||
|
||||
# Stop and disable mongodb service
|
||||
Stop-Service -Name $mongodbService
|
||||
Set-Service $mongodbService -StartupType Disabled
|
||||
Stop-Service $mongodbService
|
||||
$mongodbService | Set-Service -StartupType Disabled
|
||||
|
||||
Invoke-PesterTests -TestFile "Databases" -TestName "MongoDB"
|
||||
|
||||
Reference in New Issue
Block a user