89 lines
4.0 KiB
PowerShell
89 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\c18z23-service-channel-recovery-hysteresis-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\c18z23-service-channel-recovery-hysteresis-inner-result.json"
|
|
$innerResultFullPath = Join-Path $repoRoot $innerResultPath
|
|
|
|
$backendRoot = Join-Path $repoRoot "backend"
|
|
Push-Location $backendRoot
|
|
try {
|
|
$unitTestOutput = & go test ./internal/modules/cluster -run "TestIssueFabricServiceChannelLeaseDampensRecoveredRouteDuringRetryCooldown|TestRecordHeartbeatUsesRollingQualityWindowForRouteFeedback" 2>&1
|
|
if ($LASTEXITCODE -ne 0) {
|
|
$unitText = ($unitTestOutput | Out-String)
|
|
throw "C18Z23 recovery hysteresis backend unit tests failed:`n$unitText"
|
|
}
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
& (Join-Path $scriptDir "c18z22-service-channel-rolling-feedback-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
|
|
$backendLine = (& ssh $DockerSSH "docker ps --format '{{.Names}} {{.Image}} {{.Status}}' | grep '^rap_test_backend '") | Out-String
|
|
$backendImageOK = $backendLine.Contains("rap-backend:fabric-service-channel-0.2.198")
|
|
|
|
$result.schema_version = "c18z23.service_channel_recovery_hysteresis_smoke.v1"
|
|
$result | Add-Member -NotePropertyName c18z23_checks -NotePropertyValue ([ordered]@{
|
|
unit_recovery_hysteresis_contract_passed = ($unitTestOutput -join "`n").Contains("ok")
|
|
live_c18z22_still_passed = [bool]$result.passed
|
|
backend_0_2_198_deployed = $backendImageOK
|
|
live_rolling_feedback_still_visible = ($result.c18z22_summary.rolling_feedback_count -gt 0 -and $result.c18z22_summary.rolling_payload_count -gt 0)
|
|
live_parallel_path_still_clean = ([int]$result.backend_fallback_queue.depth -eq 0 -and [int]$result.flow_drops.delta -eq 0)
|
|
}) -Force
|
|
$result | Add-Member -NotePropertyName c18z23_summary -NotePropertyValue ([ordered]@{
|
|
unit_test_output = ($unitTestOutput | Out-String).Trim()
|
|
backend_container = $backendLine.Trim()
|
|
recovery_hysteresis_penalty = 150
|
|
backend_image = "rap-backend:fabric-service-channel-0.2.198"
|
|
node_agent_version = "0.2.196"
|
|
}) -Force
|
|
$result.passed = [bool]($result.passed -and
|
|
$result.c18z23_checks.unit_recovery_hysteresis_contract_passed -and
|
|
$result.c18z23_checks.backend_0_2_198_deployed -and
|
|
$result.c18z23_checks.live_rolling_feedback_still_visible -and
|
|
$result.c18z23_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 "C18Z23 recovery hysteresis smoke failed. Result: $resolvedResultPath"
|
|
}
|
|
|
|
Write-Host "C18Z23 service-channel recovery hysteresis smoke passed. Result: $resolvedResultPath"
|
|
$result
|