mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
21 lines
912 B
PowerShell
21 lines
912 B
PowerShell
####################################################################################
|
|
## File: Install-MongoDB.ps1
|
|
## Desc: Install MongoDB
|
|
####################################################################################
|
|
|
|
# Install mongodb package
|
|
$toolsetVersion = (Get-ToolsetContent).mongodb.version
|
|
$latestChocoPackage = Get-LatestChocoPackageVersion -TargetVersion $toolsetVersion -PackageName "mongodb"
|
|
Choco-Install -PackageName mongodb -ArgumentList "--version=$latestChocoPackage"
|
|
|
|
# Add mongodb to the PATH
|
|
$mongodbService = "mongodb"
|
|
$mongoPath = (Get-CimInstance Win32_Service -Filter "Name LIKE '$mongodbService'").PathName
|
|
$mongoBin = Split-Path -Path $mongoPath.split('"')[1]
|
|
Add-MachinePathItem "$mongoBin"
|
|
|
|
# Stop and disable mongodb service
|
|
Stop-Service -Name $mongodbService
|
|
Set-Service $mongodbService -StartupType Disabled
|
|
|
|
Invoke-PesterTests -TestFile "Databases" -TestName "MongoDB" |