Record project continuation changes
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
param(
|
||||
[string]$ApiBaseUrl = "http://192.168.200.61:18121/api/v1",
|
||||
[string]$ClusterID = "cfc0743d-d960-49fb-9de8-96e063d5e4aa",
|
||||
[string]$NodeID = "108a0d66-d65e-4dea-b9a8-135366bf7dba",
|
||||
[string]$DockerSSH = "test-docker",
|
||||
[string]$ExpectedBackendImage = "rap-backend:fabric-service-channel-0.2.204",
|
||||
[string]$ResultPath = "artifacts\c18z29-service-channel-feedback-provenance-guard-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 "TestFabricServiceChannelFeedbackStalePolicyIsConservative|TestFabricServiceChannelFeedbackMissingProvenanceIsVisibleButCompatible|TestIssueFabricServiceChannelLeaseSelectsAuthorizedRoute" 2>&1
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
$unitText = ($unitTestOutput | Out-String)
|
||||
throw "C18Z29 feedback provenance guard unit tests failed:`n$unitText"
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
$synthetic = Invoke-RestMethod -Method Get -Uri "$ApiBaseUrl/clusters/$ClusterID/nodes/$NodeID/mesh/synthetic-config"
|
||||
$feedback = $synthetic.synthetic_mesh_config.service_channel_route_feedback
|
||||
$policy = $feedback.recovery_policy
|
||||
|
||||
$backendLine = (& ssh $DockerSSH "docker ps --format '{{.Names}} {{.Image}} {{.Status}}' | grep '^rap_test_backend '") | Out-String
|
||||
$backendImageOK = $backendLine.Contains($ExpectedBackendImage)
|
||||
$policyFingerprintOK = $null -ne $policy -and [string]$policy.fingerprint -ne ""
|
||||
$provenanceCountersOK = $feedback.PSObject.Properties.Name -contains "missing_provenance_count" -or
|
||||
$feedback.PSObject.Properties.Name -contains "stale_policy_count" -or
|
||||
$feedback.PSObject.Properties.Name -contains "stale_generation_count" -or
|
||||
[int]$feedback.observation_count -eq 0
|
||||
$missingProvenanceCount = if ($feedback.PSObject.Properties.Name -contains "missing_provenance_count") { $feedback.missing_provenance_count } else { 0 }
|
||||
$stalePolicyCount = if ($feedback.PSObject.Properties.Name -contains "stale_policy_count") { $feedback.stale_policy_count } else { 0 }
|
||||
$staleGenerationCount = if ($feedback.PSObject.Properties.Name -contains "stale_generation_count") { $feedback.stale_generation_count } else { 0 }
|
||||
|
||||
$result = [ordered]@{
|
||||
schema_version = "c18z29.service_channel_feedback_provenance_guard_smoke.v1"
|
||||
passed = [bool]($backendImageOK -and $policyFingerprintOK -and $provenanceCountersOK)
|
||||
checks = [ordered]@{
|
||||
unit_feedback_provenance_guard_passed = ($unitTestOutput -join "`n").Contains("ok")
|
||||
backend_expected_image_deployed = $backendImageOK
|
||||
recovery_policy_fingerprint_present = $policyFingerprintOK
|
||||
feedback_provenance_counters_present_or_no_observations = $provenanceCountersOK
|
||||
}
|
||||
summary = [ordered]@{
|
||||
unit_test_output = ($unitTestOutput | Out-String).Trim()
|
||||
backend_container = $backendLine.Trim()
|
||||
expected_backend_image = $ExpectedBackendImage
|
||||
feedback_counts = [ordered]@{
|
||||
observations = $feedback.observation_count
|
||||
missing_provenance = $missingProvenanceCount
|
||||
stale_policy = $stalePolicyCount
|
||||
stale_generation = $staleGenerationCount
|
||||
}
|
||||
recovery_policy = $policy
|
||||
}
|
||||
}
|
||||
|
||||
$resolvedResultPath = Join-Path $repoRoot $ResultPath
|
||||
$result | ConvertTo-Json -Depth 100 | Set-Content -Path $resolvedResultPath -Encoding UTF8
|
||||
|
||||
if (-not $result.passed) {
|
||||
throw "C18Z29 feedback provenance guard smoke failed. Result: $resolvedResultPath"
|
||||
}
|
||||
|
||||
Write-Host "C18Z29 service-channel feedback provenance guard smoke passed. Result: $resolvedResultPath"
|
||||
$result
|
||||
Reference in New Issue
Block a user