Skip to content

Commit

Permalink
Add Back Pressure pester test
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaulson45 committed May 23, 2024
1 parent e346724 commit 47962b5
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 1 deletion.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Describe "Testing Health Checker by Mock Data Imports" {
Mock Invoke-ScriptBlockHandler -ParameterFilter { $ScriptBlockDescription -eq "Getting applicationHost.config" } -MockWith { return Get-Content "$Script:MockDataCollectionRoot\Exchange\IIS\applicationHost1.config" -Raw -Encoding UTF8 }
Mock Get-ExchangeDiagnosticInfo -ParameterFilter { $Process -eq "Microsoft.Exchange.Directory.TopologyService" -and $Component -eq "VariantConfiguration" -and $Argument -eq "Overrides" } `
-MockWith { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetExchangeDiagnosticInfo_ADTopVariantConfiguration1.xml" }
Mock Get-ExchangeDiagnosticInfo -ParameterFilter { $Process -eq "EdgeTransport" -and $Component -eq "ResourceThrottling" } `
-MockWith { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetExchangeDiagnosticInfo_EdgeTransportResourceThrottling1.xml" }
Mock Get-IISModules { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetIISModulesNoTokenCacheModule.xml" }
Mock Get-Service {
param(
Expand All @@ -63,6 +65,7 @@ Describe "Testing Health Checker by Mock Data Imports" {
SetActiveDisplayGrouping "Exchange Information"
TestObjectMatch "Setting Overrides Detected" $true
TestObjectMatch "Extended Protection Enabled (Any VDir)" $true
TestObjectMatch "Transport Back Pressure" "--ERROR-- The following resources are causing back pressure: DatabaseUsedSpace" -WriteType "Red"
}

It "Dependent Services" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Describe "Testing Health Checker by Mock Data Imports" {
Assert-MockCalled Get-ReceiveConnector -Exactly 1
Assert-MockCalled Get-SendConnector -Exactly 1
Assert-MockCalled Get-IISModules -Exactly 1
Assert-MockCalled Get-ExchangeDiagnosticInfo -Exactly 1
Assert-MockCalled Get-ExchangeDiagnosticInfo -Exactly 2
Assert-MockCalled Get-ExchangeADSplitPermissionsEnabled -Exactly 1
Assert-MockCalled Get-DynamicDistributionGroup -Exactly 1
Assert-MockCalled Get-ActiveSyncVirtualDirectory -Exactly 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ function Get-ExchangeDiagnosticInfo { param($Argument, $Component, $Process, $Se

Mock Get-ExchangeDiagnosticInfo -ParameterFilter { $Process -eq "Microsoft.Exchange.Directory.TopologyService" -and $Component -eq "VariantConfiguration" -and $Argument -eq "Overrides" } `
-MockWith { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetExchangeDiagnosticInfo_ADTopVariantConfiguration.xml" }
Mock Get-ExchangeDiagnosticInfo -ParameterFilter { $Process -eq "EdgeTransport" -and $Component -eq "ResourceThrottling" } `
-MockWith { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetExchangeDiagnosticInfo_EdgeTransportResourceThrottling.xml" }

# Need to use function instead of Mock for Exchange cmdlets
function Get-ExchangeServer {
Expand Down

0 comments on commit 47962b5

Please sign in to comment.