112 lines
5.6 KiB
PowerShell
112 lines
5.6 KiB
PowerShell
param(
|
|
[string]$ApiBaseUrl = "http://192.168.200.61:18121/api/v1",
|
|
[string]$ClusterID = "cfc0743d-d960-49fb-9de8-96e063d5e4aa",
|
|
[string]$ActorUserID = "f67d943f-5397-4b3a-a229-695fe67ad700",
|
|
[string]$EntryNodeName = "test-1",
|
|
[string]$RelayNodeName = "test-3",
|
|
[string]$ExitNodeName = "test-2",
|
|
[string]$EntryBaseUrl = "http://192.168.200.61:19131",
|
|
[string]$DockerSSH = "test-docker",
|
|
[int]$InitialBatchCount = 12,
|
|
[int]$LearningBatchCount = 24,
|
|
[int]$PostChurnBatchCount = 24,
|
|
[int]$PacketsPerBatch = 8,
|
|
[int]$BatchDelayMilliseconds = 25,
|
|
[string]$ResultPath = "artifacts\c18z20-service-channel-adaptive-window-telemetry-smoke-result.json"
|
|
)
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$repoRoot = (Resolve-Path (Join-Path $scriptDir "..\..")).ProviderPath
|
|
$innerResultPath = "artifacts\c18z20-service-channel-adaptive-window-telemetry-inner-result.json"
|
|
$innerResultFullPath = Join-Path $repoRoot $innerResultPath
|
|
|
|
$agentRoot = Join-Path $repoRoot "agents\rap-node-agent"
|
|
Push-Location $agentRoot
|
|
try {
|
|
$unitTestOutput = & go test ./internal/vpnruntime -run "TestFabricFlowSchedulerRecommendsSmallerWindowUnderPressure|TestFabricClientPacketIngressParallelFlowWindowDoesNotBlockIndependentChannel" 2>&1
|
|
if ($LASTEXITCODE -ne 0) {
|
|
$unitText = ($unitTestOutput | Out-String)
|
|
throw "C18Z20 adaptive window telemetry unit tests failed:`n$unitText"
|
|
}
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
& (Join-Path $scriptDir "c18z19-service-channel-parallel-flow-window-smoke.ps1") `
|
|
-ApiBaseUrl $ApiBaseUrl `
|
|
-ClusterID $ClusterID `
|
|
-ActorUserID $ActorUserID `
|
|
-EntryNodeName $EntryNodeName `
|
|
-RelayNodeName $RelayNodeName `
|
|
-ExitNodeName $ExitNodeName `
|
|
-EntryBaseUrl $EntryBaseUrl `
|
|
-DockerSSH $DockerSSH `
|
|
-InitialBatchCount $InitialBatchCount `
|
|
-LearningBatchCount $LearningBatchCount `
|
|
-PostChurnBatchCount $PostChurnBatchCount `
|
|
-PacketsPerBatch $PacketsPerBatch `
|
|
-BatchDelayMilliseconds $BatchDelayMilliseconds `
|
|
-ResultPath $innerResultPath
|
|
|
|
$result = Get-Content -Path $innerResultFullPath -Raw | ConvertFrom-Json
|
|
$ingress = $result.telemetry.final_entry_ingress
|
|
$scheduler = $ingress.flow_scheduler
|
|
$stats = @()
|
|
if ($null -ne $scheduler.channel_stats) {
|
|
$stats = @($scheduler.channel_stats.PSObject.Properties | ForEach-Object { $_.Value })
|
|
}
|
|
$attemptStats = @($stats | Where-Object { $_.PSObject.Properties["send_attempts"] -and [int64]$_.send_attempts -gt 0 })
|
|
$successStats = @($stats | Where-Object { $_.PSObject.Properties["send_successes"] -and [int64]$_.send_successes -gt 0 })
|
|
$latencyStats = @($stats | Where-Object {
|
|
(($_.PSObject.Properties["latency_le_10ms"] -and [int64]$_.latency_le_10ms -gt 0) -or
|
|
($_.PSObject.Properties["latency_le_100ms"] -and [int64]$_.latency_le_100ms -gt 0) -or
|
|
($_.PSObject.Properties["latency_le_1000ms"] -and [int64]$_.latency_le_1000ms -gt 0) -or
|
|
($_.PSObject.Properties["latency_gt_1000ms"] -and [int64]$_.latency_gt_1000ms -gt 0))
|
|
})
|
|
$maxParallel = if ($ingress.PSObject.Properties["max_parallel_flow_sends"]) { [int]$ingress.max_parallel_flow_sends } else { 0 }
|
|
$recommended = if ($ingress.PSObject.Properties["recommended_parallel_flow_sends"]) { [int]$ingress.recommended_parallel_flow_sends } else { 0 }
|
|
$maxInFlight = if ($scheduler.PSObject.Properties["max_in_flight"]) { [int]$scheduler.max_in_flight } else { 0 }
|
|
$inFlight = if ($scheduler.PSObject.Properties["in_flight"]) { [int]$scheduler.in_flight } else { -1 }
|
|
|
|
$result.schema_version = "c18z20.service_channel_adaptive_window_telemetry_smoke.v1"
|
|
$result | Add-Member -NotePropertyName c18z20_checks -NotePropertyValue ([ordered]@{
|
|
unit_adaptive_window_pressure_contract_passed = ($unitTestOutput -join "`n").Contains("ok")
|
|
live_recommended_window_visible = ($recommended -gt 0 -and $recommended -le $maxParallel)
|
|
live_inflight_telemetry_visible = ($maxInFlight -ge 2 -and $inFlight -eq 0)
|
|
live_per_channel_attempt_telemetry_visible = ($attemptStats.Count -ge 2 -and $successStats.Count -ge 2)
|
|
live_per_channel_latency_buckets_visible = ($latencyStats.Count -ge 2)
|
|
live_parallel_path_still_clean = ([bool]$result.passed -and [int]$result.degraded_route_queue.depth -eq 0 -and [int]$result.flow_drops.delta -eq 0)
|
|
}) -Force
|
|
$result | Add-Member -NotePropertyName c18z20_summary -NotePropertyValue ([ordered]@{
|
|
unit_test_output = ($unitTestOutput | Out-String).Trim()
|
|
max_parallel_flow_sends = $maxParallel
|
|
recommended_parallel_flow_sends = $recommended
|
|
scheduler_in_flight = $inFlight
|
|
scheduler_max_in_flight = $maxInFlight
|
|
attempt_channel_count = $attemptStats.Count
|
|
success_channel_count = $successStats.Count
|
|
latency_channel_count = $latencyStats.Count
|
|
}) -Force
|
|
$result.passed = [bool]($result.passed -and
|
|
$result.c18z20_checks.unit_adaptive_window_pressure_contract_passed -and
|
|
$result.c18z20_checks.live_recommended_window_visible -and
|
|
$result.c18z20_checks.live_inflight_telemetry_visible -and
|
|
$result.c18z20_checks.live_per_channel_attempt_telemetry_visible -and
|
|
$result.c18z20_checks.live_per_channel_latency_buckets_visible -and
|
|
$result.c18z20_checks.live_parallel_path_still_clean)
|
|
|
|
$resolvedResultPath = Join-Path $repoRoot $ResultPath
|
|
$result | ConvertTo-Json -Depth 100 | Set-Content -Path $resolvedResultPath -Encoding UTF8
|
|
Remove-Item -Path $innerResultFullPath -Force -ErrorAction SilentlyContinue
|
|
|
|
if (-not $result.passed) {
|
|
throw "C18Z20 adaptive window telemetry smoke failed. Result: $resolvedResultPath"
|
|
}
|
|
|
|
Write-Host "C18Z20 service-channel adaptive window telemetry smoke passed. Result: $resolvedResultPath"
|
|
$result
|
|
|