@@ -112,5 +112,43 @@ if ($arrayResult.ExitCode -eq 0) {
|
||||
$results += @{ Passed = $false; Reason = "array read exit $($arrayResult.ExitCode)" }
|
||||
}
|
||||
|
||||
# PR 8 — deadband subscribe assertion. Subscribe with --deadband-absolute 5,
|
||||
# write three small deltas (each within the 5-unit deadband), assert exactly
|
||||
# one notification fires (the first-seen sample). The fourth write breaks
|
||||
# above the threshold and the subscription should fire again.
|
||||
Write-Header "Deadband subscribe (--deadband-absolute 5)"
|
||||
$baseValue = Get-Random -Minimum 100 -Maximum 200
|
||||
& $abLegacyCli.File @($abLegacyCli.PrefixArgs) `
|
||||
@("write") + $commonAbLegacy + @("-a", $Address, "-t", "Int", "-v", $baseValue) | Out-Null
|
||||
$subscribeProc = Start-Process -FilePath $abLegacyCli.File `
|
||||
-ArgumentList ($abLegacyCli.PrefixArgs + @("subscribe") + $commonAbLegacy `
|
||||
+ @("-a", $Address, "-t", "Int", "-i", "200", "--deadband-absolute", "5")) `
|
||||
-PassThru -RedirectStandardOutput "$env:TEMP/ablegacy-deadband.out" `
|
||||
-RedirectStandardError "$env:TEMP/ablegacy-deadband.err"
|
||||
Start-Sleep -Seconds 2
|
||||
# Three small deltas within deadband.
|
||||
& $abLegacyCli.File @($abLegacyCli.PrefixArgs) `
|
||||
@("write") + $commonAbLegacy + @("-a", $Address, "-t", "Int", "-v", ($baseValue + 1)) | Out-Null
|
||||
Start-Sleep -Milliseconds 500
|
||||
& $abLegacyCli.File @($abLegacyCli.PrefixArgs) `
|
||||
@("write") + $commonAbLegacy + @("-a", $Address, "-t", "Int", "-v", ($baseValue + 2)) | Out-Null
|
||||
Start-Sleep -Milliseconds 500
|
||||
& $abLegacyCli.File @($abLegacyCli.PrefixArgs) `
|
||||
@("write") + $commonAbLegacy + @("-a", $Address, "-t", "Int", "-v", ($baseValue + 3)) | Out-Null
|
||||
Start-Sleep -Milliseconds 500
|
||||
Stop-Process -Id $subscribeProc.Id -Force -ErrorAction SilentlyContinue
|
||||
$subscribeOutput = Get-Content "$env:TEMP/ablegacy-deadband.out" -ErrorAction SilentlyContinue
|
||||
# Count `=` lines (the SubscribeCommand format prints one per OnDataChange). Expect exactly 1
|
||||
# (the first-seen sample at $baseValue) — none of the +1/+2/+3 deltas crosses the 5 absolute.
|
||||
$notifyLines = @($subscribeOutput | Where-Object { $_ -match " = " })
|
||||
if ($notifyLines.Count -eq 1) {
|
||||
Write-Pass "deadband subscribe emitted 1 notification (initial only); 3 sub-threshold writes suppressed"
|
||||
$results += @{ Passed = $true }
|
||||
} else {
|
||||
Write-Fail "deadband subscribe expected 1 notification; got $($notifyLines.Count)"
|
||||
Write-Host ($subscribeOutput -join "`n")
|
||||
$results += @{ Passed = $false; Reason = "deadband notify count $($notifyLines.Count)" }
|
||||
}
|
||||
|
||||
Write-Summary -Title "AB Legacy e2e" -Results $results
|
||||
if ($results | Where-Object { -not $_.Passed }) { exit 1 }
|
||||
|
||||
Reference in New Issue
Block a user