36 lines
1.3 KiB
PowerShell
36 lines
1.3 KiB
PowerShell
|
Function Test-IsLoadTestEnvironment {
|
|||
|
<#
|
|||
|
.SYNOPSIS
|
|||
|
Returns true if the environment type is designated as for-sure LoadTest or if the environment name of the ComputerName machine matches the load test environment pattern
|
|||
|
|
|||
|
.PARAMETER ComputerName
|
|||
|
The machine to test.
|
|||
|
#>
|
|||
|
[CmdletBinding(DefaultParameterSetName = 'ByComputer')]
|
|||
|
[OutputType([System.Boolean])]
|
|||
|
Param(
|
|||
|
[Parameter(Mandatory=$false, ParameterSetName = "ByComputer")]
|
|||
|
[string]$ComputerName = "localhost",
|
|||
|
[Parameter(Mandatory=$false, ParameterSetName = "ByEnvironmentName")]
|
|||
|
[string]$EnvironmentName = $null
|
|||
|
|
|||
|
)
|
|||
|
|
|||
|
$environmentType = (Get-EnvironmentType -ComputerName $ComputerName)
|
|||
|
|
|||
|
$environmentTypeNames = @('LoadTest')
|
|||
|
|
|||
|
if ($environmentTypeNames -contains $environmentType) {
|
|||
|
return $true
|
|||
|
}
|
|||
|
|
|||
|
if([string]::IsNullOrWhiteSpace($EnvironmentName)) {
|
|||
|
# It's a load test environment if the environment name contains the whole word "vPod".
|
|||
|
# Note: We can't trust the Environment.Type because it is set to Staging.
|
|||
|
$EnvironmentName = Get-AppSetting -Key "Environment.Name" -ComputerName $ComputerName
|
|||
|
}
|
|||
|
|
|||
|
$isLoadTestEnvironment = ($EnvironmentName -match "\bvPod\b") -or ($EnvironmentName -match "ltvpod");
|
|||
|
|
|||
|
return $isLoadTestEnvironment
|
|||
|
}
|