Don't start windows service in tests

This commit is contained in:
twangboy 2024-11-04 14:29:27 -07:00
parent f36c2c06a3
commit 7c350c4f48
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB
2 changed files with 22 additions and 28 deletions

View file

@ -48,24 +48,23 @@ jobs:
- name: Install Pytest
run: |
pip install -U pytest
pip install -r tests\requirements.txt
- name: Get Version
run: |
# We need to get the version here and make it an environment variable
# It is used to install via bootstrap and in the test
# The version is in the instance name
$instance = "${{ matrix.instance }}"
$version = $instance -split "-",2
if ( $version.Count -gt 1 ) {
$version = $version[1].Replace("-", ".")
}
Write-Output "SaltVersion=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Bootstrap Salt
run: |
. ./bootstrap-salt.ps1 -RunService $false
- name: Set Environment Variables
run: |
$env:Path = "$env:Path;C:\Program Files\Salt Project\Salt"
$env:Instance = ${{ matrix.instance }}
Write-Output "Path:"
Write-Output $env:Path
Write-Output "Environment Variables"
Get-ChildItem Env:
- name: Add Salt to Path
run: |
$env:Path = "$env:Path;C:\Program Files\Salt Project\Salt"
. .\bootstrap-salt.ps1 -RunService $false -Version $env:SaltVersion
- name: Test Bootstrap
run: |
@ -82,4 +81,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: exitstatus-${{ github.job }}-${{ matrix.instance }}-${{ inputs.distro-slug }}
path: exitstatus/
path: exitstatus/

View file

@ -18,7 +18,7 @@
Specifies a particular version of the installer.
.EXAMPLE
./bootstrap-salt.ps1 -RunService false
./bootstrap-salt.ps1 -RunService $false
Specifies the salt-minion service to stop and be set to manual. Useful for
testing locally from the command line with the --local switch
@ -28,7 +28,7 @@
installer values of host name for the minion id and "salt" for the master.
.EXAMPLE
./bootstrap-salt.ps1 -Minion minion-box -Master master-box -Version 3006.7 -RunService false
./bootstrap-salt.ps1 -Minion minion-box -Master master-box -Version 3006.7 -RunService $false
Specifies all the optional parameters in no particular order.
.NOTES
@ -56,12 +56,11 @@ param(
[String]$Version = "latest",
[Parameter(Mandatory=$false, ValueFromPipeline=$True)]
[ValidateSet("true","false")]
[Alias("s")]
# Boolean flag to start or stop the minion service. True will start the
# minion service. False will stop the minion service and set it to "manual".
# Boolean flag to start or stop the minion service. $true will start the
# minion service. $false will stop the minion service and set it to "manual".
# The installer starts it by default.
[String]$RunService = "true",
[Bool]$RunService = $true,
[Parameter(Mandatory=$false, ValueFromPipeline=$True)]
[Alias("m")]
@ -331,16 +330,12 @@ Write-Verbose "apiurl: $ApiUrl"
Write-Verbose "ConfDir: $ConfDir"
Write-Verbose "RootDir: $RootDir"
if ($RunService.ToLower() -eq "true") {
if ($RunService) {
Write-Verbose "Windows service will be set to run"
[bool]$RunService = $True
} elseif ($RunService.ToLower() -eq "false") {
} else {
Write-Verbose "Windows service will be stopped and set to manual"
[bool]$RunService = $False
} else {
# Param passed in wasn't clear so defaulting to true.
Write-Verbose "Windows service defaulting to run automatically"
[bool]$RunService = $True
}
#===============================================================================