83 lines
4.0 KiB
PowerShell
83 lines
4.0 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\c18z17-live-service-channel-quality-cleanup-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\c18z17-live-service-channel-quality-cleanup-inner-result.json"
|
|
$innerResultFullPath = Join-Path $repoRoot $innerResultPath
|
|
|
|
& (Join-Path $scriptDir "c18z16-live-service-channel-quality-fairness-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
|
|
$finalIngress = $result.telemetry.final_entry_ingress
|
|
$stats = @($finalIngress.flow_scheduler.channel_stats.PSObject.Properties | ForEach-Object { $_.Value })
|
|
$activeMarkers = @($stats | Where-Object {
|
|
$_.PSObject.Properties["quality_preference_route_id"] -and
|
|
-not [string]::IsNullOrWhiteSpace([string]$_.quality_preference_route_id)
|
|
})
|
|
$validPreferenceIDs = @{}
|
|
foreach ($preference in @($finalIngress.route_quality_preferences)) {
|
|
$validPreferenceIDs[[string]$preference.route_id] = $true
|
|
}
|
|
$staleMarkers = @($activeMarkers | Where-Object { -not $validPreferenceIDs.ContainsKey([string]$_.quality_preference_route_id) })
|
|
|
|
$result.schema_version = "c18z17.live_service_channel_quality_cleanup_smoke.v1"
|
|
$result | Add-Member -NotePropertyName c18z17_checks -NotePropertyValue ([ordered]@{
|
|
stale_channel_quality_markers_absent = ($staleMarkers.Count -eq 0)
|
|
active_markers_reference_visible_preferences = ($activeMarkers.Count -gt 0 -and $staleMarkers.Count -eq 0)
|
|
expired_route_intents_not_active = ([string]$result.route_intents.fast_status -eq "expired" -and [string]$result.route_intents.slow_candidate_status -eq "expired" -and [string]$result.route_intents.slow_initial_status -eq "expired")
|
|
session_completed_without_backend_fallback = ([int]$result.backend_fallback_queue.depth -eq 0)
|
|
}) -Force
|
|
$result | Add-Member -NotePropertyName c18z17_summary -NotePropertyValue ([ordered]@{
|
|
active_quality_marker_count = $activeMarkers.Count
|
|
stale_quality_marker_count = $staleMarkers.Count
|
|
visible_quality_preference_count = @($finalIngress.route_quality_preferences).Count
|
|
}) -Force
|
|
$result.passed = [bool]($result.passed -and
|
|
$result.c18z17_checks.stale_channel_quality_markers_absent -and
|
|
$result.c18z17_checks.active_markers_reference_visible_preferences -and
|
|
$result.c18z17_checks.expired_route_intents_not_active -and
|
|
$result.c18z17_checks.session_completed_without_backend_fallback)
|
|
|
|
$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 "C18Z17 route-quality cleanup smoke failed. Result: $resolvedResultPath"
|
|
}
|
|
|
|
Write-Host "C18Z17 live service-channel quality cleanup smoke passed. Result: $resolvedResultPath"
|
|
$result
|