117 lines
6.1 KiB
PowerShell
117 lines
6.1 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\c18z21-service-channel-rolling-quality-window-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\c18z21-service-channel-rolling-quality-window-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 "TestFabricFlowSchedulerRollingQualityWindowForgetsOldPressure|TestFabricFlowSchedulerRecommendsSmallerWindowUnderPressure|TestFabricClientPacketIngressParallelFlowWindowDoesNotBlockIndependentChannel" 2>&1
|
|
if ($LASTEXITCODE -ne 0) {
|
|
$unitText = ($unitTestOutput | Out-String)
|
|
throw "C18Z21 rolling quality window unit tests failed:`n$unitText"
|
|
}
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
& (Join-Path $scriptDir "c18z20-service-channel-adaptive-window-telemetry-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 })
|
|
}
|
|
$rollingStats = @($stats | Where-Object {
|
|
$_.PSObject.Properties["quality_window_sample_count"] -and [int]$_.quality_window_sample_count -gt 0
|
|
})
|
|
$rollingSuccessStats = @($stats | Where-Object {
|
|
$_.PSObject.Properties["quality_window_success_count"] -and [int]$_.quality_window_success_count -gt 0
|
|
})
|
|
$rollingLatencyStats = @($stats | Where-Object {
|
|
$_.PSObject.Properties["quality_window_avg_latency_ms"] -and [int64]$_.quality_window_avg_latency_ms -ge 0
|
|
})
|
|
$schedulerWindowSamples = if ($scheduler.PSObject.Properties["quality_window_sample_count"]) { [int]$scheduler.quality_window_sample_count } else { 0 }
|
|
$schedulerWindowFailures = if ($scheduler.PSObject.Properties["quality_window_failure_count"]) { [int]$scheduler.quality_window_failure_count } else { -1 }
|
|
$schedulerWindowDrops = if ($scheduler.PSObject.Properties["quality_window_drop_count"]) { [int]$scheduler.quality_window_drop_count } else { -1 }
|
|
$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 }
|
|
|
|
$result.schema_version = "c18z21.service_channel_rolling_quality_window_smoke.v1"
|
|
$result | Add-Member -NotePropertyName c18z21_checks -NotePropertyValue ([ordered]@{
|
|
unit_rolling_quality_contract_passed = ($unitTestOutput -join "`n").Contains("ok")
|
|
live_scheduler_window_telemetry_visible = ($schedulerWindowSamples -gt 0 -and $schedulerWindowFailures -ge 0 -and $schedulerWindowDrops -ge 0)
|
|
live_per_channel_window_samples_visible = ($rollingStats.Count -ge 2)
|
|
live_per_channel_window_success_visible = ($rollingSuccessStats.Count -ge 2)
|
|
live_per_channel_window_latency_visible = ($rollingLatencyStats.Count -ge 2)
|
|
live_adaptive_window_still_open = ($recommended -gt 0 -and $recommended -le $maxParallel)
|
|
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 c18z21_summary -NotePropertyValue ([ordered]@{
|
|
unit_test_output = ($unitTestOutput | Out-String).Trim()
|
|
scheduler_quality_window_sample_count = $schedulerWindowSamples
|
|
scheduler_quality_window_failure_count = $schedulerWindowFailures
|
|
scheduler_quality_window_drop_count = $schedulerWindowDrops
|
|
quality_window_channel_count = $rollingStats.Count
|
|
quality_window_success_channel_count = $rollingSuccessStats.Count
|
|
quality_window_latency_channel_count = $rollingLatencyStats.Count
|
|
max_parallel_flow_sends = $maxParallel
|
|
recommended_parallel_flow_sends = $recommended
|
|
}) -Force
|
|
$result.passed = [bool]($result.passed -and
|
|
$result.c18z21_checks.unit_rolling_quality_contract_passed -and
|
|
$result.c18z21_checks.live_scheduler_window_telemetry_visible -and
|
|
$result.c18z21_checks.live_per_channel_window_samples_visible -and
|
|
$result.c18z21_checks.live_per_channel_window_success_visible -and
|
|
$result.c18z21_checks.live_per_channel_window_latency_visible -and
|
|
$result.c18z21_checks.live_adaptive_window_still_open -and
|
|
$result.c18z21_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 "C18Z21 rolling quality window smoke failed. Result: $resolvedResultPath"
|
|
}
|
|
|
|
Write-Host "C18Z21 service-channel rolling quality window smoke passed. Result: $resolvedResultPath"
|
|
$result
|
|
|