Record project continuation changes

This commit is contained in:
2026-05-12 21:02:29 +03:00
parent 3059d1d7a3
commit 8f69d53193
339 changed files with 101111 additions and 1769 deletions
@@ -0,0 +1,97 @@
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]$ExitNodeName = "test-2",
[string]$EntryBaseUrl = "http://192.168.200.61:19131",
[string]$DockerSSH = "test-docker",
[string]$ExpectedBackendImage = "rap-backend:fabric-service-channel-0.2.215",
[string]$ExpectedNodeAgentImage = "rap-node-agent:0.2.208",
[string]$ResultPath = "artifacts\c18z34-service-channel-rebuild-health-smoke-result.json"
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$repoRoot = (Resolve-Path (Join-Path $scriptDir "..\..")).ProviderPath
$baseResultPath = "artifacts\c18z34-base-rebuild-guard-smoke-result.json"
& (Join-Path $scriptDir "c18z33-service-channel-rebuild-guard-smoke.ps1") `
-ApiBaseUrl $ApiBaseUrl `
-ClusterID $ClusterID `
-ActorUserID $ActorUserID `
-EntryNodeName $EntryNodeName `
-ExitNodeName $ExitNodeName `
-EntryBaseUrl $EntryBaseUrl `
-DockerSSH $DockerSSH `
-ExpectedBackendImage $ExpectedBackendImage `
-ExpectedNodeAgentImage $ExpectedNodeAgentImage `
-ResultPath $baseResultPath | Out-Null
$health = (Invoke-RestMethod -Method Get -Uri "$ApiBaseUrl/clusters/$ClusterID/fabric/service-channels/rebuild-health?actor_user_id=$ActorUserID&limit=5" -TimeoutSec 30).rebuild_health
$backendLine = (& ssh $DockerSSH "docker ps --format '{{.Names}} {{.Image}} {{.Status}}' | grep '^rap_test_backend '") | Out-String
$nodeLines = (& ssh $DockerSSH "docker ps --format '{{.Names}} {{.Image}} {{.Status}}' | grep '^rap_test_node_test_'") | Out-String
function Get-Prop {
param([object]$Object, [string]$Name)
if ($null -eq $Object) { return $null }
$prop = $Object.PSObject.Properties[$Name]
if ($null -eq $prop) { return $null }
return $prop.Value
}
$statusCounts = Get-Prop $health "counts_by_guard_status"
$severityCounts = Get-Prop $health "counts_by_guard_severity"
$okCount = 0
if ($null -ne $statusCounts -and $null -ne $statusCounts.PSObject.Properties["ok"]) {
$okCount = [int]$statusCounts.ok
}
$goodCount = 0
if ($null -ne $severityCounts -and $null -ne $severityCounts.PSObject.Properties["good"]) {
$goodCount = [int]$severityCounts.good
}
$result = [ordered]@{
schema_version = "c18z34.service_channel_rebuild_health_smoke.v1"
cluster_id = $ClusterID
passed = [bool](
$backendLine.Contains($ExpectedBackendImage) -and
$nodeLines.Contains($ExpectedNodeAgentImage) -and
[int]$health.total_attempts -gt 0 -and
[int]$health.good_count -ge 1 -and
$okCount -ge 1 -and
$goodCount -ge 1 -and
[string]$health.recommended_operator_action
)
checks = [ordered]@{
backend_expected_image_deployed = $backendLine.Contains($ExpectedBackendImage)
node_agent_expected_image_deployed = $nodeLines.Contains($ExpectedNodeAgentImage)
has_attempts = ([int]$health.total_attempts -gt 0)
has_good_count = ([int]$health.good_count -ge 1)
status_ok_counted = ($okCount -ge 1)
severity_good_counted = ($goodCount -ge 1)
has_operator_action = ([string]$health.recommended_operator_action).Length -gt 0
}
summary = [ordered]@{
backend_container = $backendLine.Trim()
node_containers = $nodeLines.Trim()
health = $health
base_smoke_result = (Join-Path $repoRoot $baseResultPath)
}
}
$resultFullPath = Join-Path $repoRoot $ResultPath
$resultDir = Split-Path -Parent $resultFullPath
if (-not (Test-Path $resultDir)) {
New-Item -ItemType Directory -Path $resultDir | Out-Null
}
$result | ConvertTo-Json -Depth 100 | Set-Content -Path $resultFullPath -Encoding UTF8
if (-not $result.passed) {
throw "C18Z34 service-channel rebuild health smoke failed. Result: $resultFullPath"
}
Write-Host "C18Z34 service-channel rebuild health smoke passed. Result: $resultFullPath"
$result