Cap WSB job history request at 100

Get-WBJob -Previous only accepts 1-100, so asking for 200 failed
collector setup on every run ("The 200 argument is greater than the
maximum allowed range of 100"). 100 still covers a 30-day backfill at
up to 3 backups a day. The mock now enforces the same range.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-08 09:33:07 -06:00
co-authored by Claude Opus 5.5
parent b625a8af65
commit 555e928e01
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -44,8 +44,9 @@ $DataDir = Split-Path -Parent $ConfigPath
$LogPath = Join-Path $DataDir 'wsb-collector.log' $LogPath = Join-Path $DataDir 'wsb-collector.log'
$StatePath = Join-Path $DataDir 'wsb-collector.state.json' $StatePath = Join-Path $DataDir 'wsb-collector.state.json'
$MaxLogBytes = 5MB $MaxLogBytes = 5MB
# Covers 30 days at several backups a day # Get-WBJob -Previous accepts at most 100. That covers a 30-day backfill at up to 3 backups a day;
$MaxPreviousJobs = 200 # servers backing up more often only get their latest 100 runs backfilled.
$MaxPreviousJobs = 100
$Invariant = [Globalization.CultureInfo]::InvariantCulture $Invariant = [Globalization.CultureInfo]::InvariantCulture
# ---------- Helpers ---------- # ---------- Helpers ----------
+2 -1
View File
@@ -92,7 +92,8 @@ $global:MockWsbSummary = [pscustomobject]@{
CurrentOperationStatus = $(if ($WithRunningJob) { 'BackupInProgress' } else { 'NoOperationInProgress' }) CurrentOperationStatus = $(if ($WithRunningJob) { 'BackupInProgress' } else { 'NoOperationInProgress' })
} }
function Get-WBJob { param([int]$Previous) if ($PSBoundParameters.ContainsKey('Previous')) { $global:MockWsbPrevious } else { $global:MockWsbRunning } } # Same limit as the real cmdlet
function Get-WBJob { param([ValidateRange(1, 100)][int]$Previous) if ($PSBoundParameters.ContainsKey('Previous')) { $global:MockWsbPrevious } else { $global:MockWsbRunning } }
function Get-WBSummary { $global:MockWsbSummary } function Get-WBSummary { $global:MockWsbSummary }
function Get-WBPolicy { [pscustomobject]@{ PolicyName = 'Scheduled' } } function Get-WBPolicy { [pscustomobject]@{ PolicyName = 'Scheduled' } }
function Get-WBSchedule { param($Policy) @($global:MockWsbSummary.NextBackupTime) } function Get-WBSchedule { param($Policy) @($global:MockWsbSummary.NextBackupTime) }