110 lines
5.2 KiB
PowerShell
110 lines
5.2 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\c18z18-service-channel-session-scoped-fairness-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\c18z18-service-channel-session-scoped-fairness-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 "TestFabricClientPacketIngressIsolatesRouteMemoryPerVPNConnection|TestFabricClientPacketIngressQualityPreferencePreservesMultiChannelFairness" 2>&1
|
|
if ($LASTEXITCODE -ne 0) {
|
|
$unitText = ($unitTestOutput | Out-String)
|
|
throw "C18Z18 unit isolation/fairness tests failed:`n$unitText"
|
|
}
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
& (Join-Path $scriptDir "c18z17-live-service-channel-quality-cleanup-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
|
|
$resourceID = [string]$result.resource_id
|
|
$finalIngress = $result.telemetry.final_entry_ingress
|
|
$stats = @()
|
|
if ($null -ne $finalIngress.flow_scheduler.channel_stats) {
|
|
$stats = @($finalIngress.flow_scheduler.channel_stats.PSObject.Properties | ForEach-Object {
|
|
[pscustomobject]@{
|
|
channel = $_.Name
|
|
served = [int64]$_.Value.served
|
|
dropped = [int64]$_.Value.dropped
|
|
quality_preference_route_id = if ($_.Value.PSObject.Properties["quality_preference_route_id"]) { [string]$_.Value.quality_preference_route_id } else { "" }
|
|
}
|
|
})
|
|
}
|
|
$servedStats = @($stats | Where-Object { $_.served -gt 0 })
|
|
$sessionPrefix = "vpn:$resourceID`:flow-"
|
|
$sessionScopedStats = @($servedStats | Where-Object { $_.channel.StartsWith($sessionPrefix) })
|
|
$unscopedServedStats = @($servedStats | Where-Object { $_.channel -match "^flow-[0-9][0-9]$" })
|
|
$sessionScopedQualityStats = @($sessionScopedStats | Where-Object { -not [string]::IsNullOrWhiteSpace($_.quality_preference_route_id) })
|
|
|
|
$result.schema_version = "c18z18.service_channel_session_scoped_fairness_smoke.v1"
|
|
$result | Add-Member -NotePropertyName c18z18_checks -NotePropertyValue ([ordered]@{
|
|
unit_multi_session_route_memory_isolated = ($unitTestOutput -join "`n").Contains("ok")
|
|
live_served_channels_are_session_scoped = ($servedStats.Count -gt 0 -and $sessionScopedStats.Count -eq $servedStats.Count)
|
|
live_unscoped_served_channels_absent = ($unscopedServedStats.Count -eq 0)
|
|
live_quality_markers_are_session_scoped = ($sessionScopedQualityStats.Count -ge 2)
|
|
live_session_completed_without_degraded_route = ([int]$result.degraded_route_queue.depth -eq 0)
|
|
live_session_completed_without_flow_drops = ([int]$result.flow_drops.delta -eq 0)
|
|
}) -Force
|
|
$result | Add-Member -NotePropertyName c18z18_summary -NotePropertyValue ([ordered]@{
|
|
unit_test_output = ($unitTestOutput | Out-String).Trim()
|
|
served_channel_count = $servedStats.Count
|
|
session_scoped_served_channel_count = $sessionScopedStats.Count
|
|
session_scoped_quality_channel_count = $sessionScopedQualityStats.Count
|
|
unscoped_served_channel_count = $unscopedServedStats.Count
|
|
session_prefix = $sessionPrefix
|
|
}) -Force
|
|
$result.passed = [bool]($result.passed -and
|
|
$result.c18z18_checks.unit_multi_session_route_memory_isolated -and
|
|
$result.c18z18_checks.live_served_channels_are_session_scoped -and
|
|
$result.c18z18_checks.live_unscoped_served_channels_absent -and
|
|
$result.c18z18_checks.live_quality_markers_are_session_scoped -and
|
|
$result.c18z18_checks.live_session_completed_without_degraded_route -and
|
|
$result.c18z18_checks.live_session_completed_without_flow_drops)
|
|
|
|
$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 "C18Z18 session-scoped fairness smoke failed. Result: $resolvedResultPath"
|
|
}
|
|
|
|
Write-Host "C18Z18 service-channel session-scoped fairness smoke passed. Result: $resolvedResultPath"
|
|
$result
|
|
|