Record project continuation changes
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
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]$DockerSSH = "test-docker",
|
||||
[string]$ExpectedBackendImage = "rap-backend:fabric-service-channel-0.2.201",
|
||||
[string]$ResultPath = "artifacts\c18z26-service-channel-recovery-demotion-smoke-result.json"
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$repoRoot = (Resolve-Path (Join-Path $scriptDir "..\..")).ProviderPath
|
||||
$backendRoot = Join-Path $repoRoot "backend"
|
||||
|
||||
Push-Location $backendRoot
|
||||
try {
|
||||
$unitTestOutput = & go test ./internal/modules/cluster -run "TestServiceChannelRouteFeedbackReportExposesRecoveryState|TestFabricServiceChannelRecoveryPromotionRemovesHysteresisPenalty|TestFabricServiceChannelRecoveryDemotionMarksRouteReason|TestRoutePathDecisionReportCountsRecoveryHysteresis" 2>&1
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
$unitText = ($unitTestOutput | Out-String)
|
||||
throw "C18Z26 recovery demotion backend unit tests failed:`n$unitText"
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
$feedbackUrl = "$ApiBaseUrl/clusters/$ClusterID/fabric/service-channels/route-feedback?actor_user_id=$ActorUserID&include_expired=true"
|
||||
$feedbackResponse = Invoke-RestMethod -Method Get -Uri $feedbackUrl
|
||||
$feedbackItems = @($feedbackResponse.route_feedback)
|
||||
$feedbackHasRecoveryState = $true
|
||||
foreach ($item in $feedbackItems) {
|
||||
$properties = @($item.PSObject.Properties.Name)
|
||||
if (-not ($properties -contains "recovery_state")) {
|
||||
$feedbackHasRecoveryState = $false
|
||||
}
|
||||
}
|
||||
|
||||
$backendLine = (& ssh $DockerSSH "docker ps --format '{{.Names}} {{.Image}} {{.Status}}' | grep '^rap_test_backend '") | Out-String
|
||||
$backendImageOK = $backendLine.Contains($ExpectedBackendImage)
|
||||
|
||||
$result = [ordered]@{
|
||||
schema_version = "c18z26.service_channel_recovery_demotion_smoke.v1"
|
||||
passed = [bool]($backendImageOK -and $feedbackHasRecoveryState)
|
||||
checks = [ordered]@{
|
||||
unit_recovery_demotion_contract_passed = ($unitTestOutput -join "`n").Contains("ok")
|
||||
backend_expected_image_deployed = $backendImageOK
|
||||
route_feedback_api_has_recovery_state = $feedbackHasRecoveryState
|
||||
}
|
||||
summary = [ordered]@{
|
||||
unit_test_output = ($unitTestOutput | Out-String).Trim()
|
||||
backend_container = $backendLine.Trim()
|
||||
expected_backend_image = $ExpectedBackendImage
|
||||
route_feedback_count = $feedbackItems.Count
|
||||
demoted_route_count = @($feedbackItems | Where-Object {
|
||||
$properties = @($_.PSObject.Properties.Name)
|
||||
($properties -contains "recovery_demoted") -and $_.recovery_demoted
|
||||
}).Count
|
||||
}
|
||||
}
|
||||
|
||||
$resolvedResultPath = Join-Path $repoRoot $ResultPath
|
||||
$result | ConvertTo-Json -Depth 100 | Set-Content -Path $resolvedResultPath -Encoding UTF8
|
||||
|
||||
if (-not $result.passed) {
|
||||
throw "C18Z26 recovery demotion smoke failed. Result: $resolvedResultPath"
|
||||
}
|
||||
|
||||
Write-Host "C18Z26 service-channel recovery demotion smoke passed. Result: $resolvedResultPath"
|
||||
$result
|
||||
Reference in New Issue
Block a user