156 lines
9.9 KiB
PowerShell
156 lines
9.9 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]$RequestedNodeName = "test-1",
|
|
[string]$DefaultNodeName = "test-2",
|
|
[string]$MatrixNodeName = "test-1",
|
|
[string]$ResultPath = "artifacts\c19z155-remote-workspace-real-adapter-not-approved-outcome-operator-stop-status-catalog-release-marker-smoke-result.json"
|
|
)
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).ProviderPath
|
|
$sourceResultPath = "artifacts\c19z155-remote-workspace-real-adapter-not-approved-outcome-operator-stop-status-catalog-release-marker-source-result.json"
|
|
$requiredReleaseFields = @("schema_version", "source_catalog_schema", "release_status", "release_marker", "catalog_status", "catalog_entry_type", "operator_status", "operator_action", "display_severity", "next_allowed_entrypoint", "attempt_allowed", "block_reason", "blocks_not_approved_extension", "enablement_status", "runtime_gate_state", "runtime_effect", "allows_process_start", "allows_payload_traffic", "guardrail_summary", "release_notes")
|
|
$requiredGuardrailFields = @("activation_blocked", "process_start_allowed", "health_probe_enabled", "payload_traffic", "allows_process_start", "allows_payload_traffic")
|
|
$requiredReleaseNotes = @("operator_stop_status_catalog_release_marked", "not_approved_branch_remains_closed", "new_explicit_enablement_request_required", "real_runtime_gate_not_enabled", "process_start_disabled", "payload_forwarding_disabled")
|
|
|
|
function Get-PropertyValue {
|
|
param([object]$Item, [string]$Name, [object]$Default = $null)
|
|
if ($null -eq $Item) { return $Default }
|
|
if ($Item -is [System.Collections.IDictionary]) {
|
|
if ($Item.Contains($Name)) { return $Item[$Name] }
|
|
return $Default
|
|
}
|
|
$property = $Item.PSObject.Properties[$Name]
|
|
if ($null -eq $property) { return $Default }
|
|
return $property.Value
|
|
}
|
|
|
|
function Test-ObjectHasFields {
|
|
param([object]$Item, [string[]]$Fields)
|
|
if ($null -eq $Item) { return $false }
|
|
foreach ($field in $Fields) {
|
|
if ($Item -is [System.Collections.IDictionary]) {
|
|
if (-not $Item.Contains($field)) { return $false }
|
|
continue
|
|
}
|
|
if ($null -eq $Item.PSObject.Properties[$field]) { return $false }
|
|
}
|
|
return $true
|
|
}
|
|
|
|
function Test-ArrayContainsAll {
|
|
param([object[]]$Actual, [string[]]$Expected)
|
|
foreach ($item in $Expected) {
|
|
if ($Actual -notcontains $item) { return $false }
|
|
}
|
|
return $true
|
|
}
|
|
|
|
& powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "c19z154-remote-workspace-real-adapter-not-approved-outcome-operator-stop-status-catalog-compatibility-smoke.ps1") `
|
|
-ApiBaseUrl $ApiBaseUrl `
|
|
-ClusterID $ClusterID `
|
|
-ActorUserID $ActorUserID `
|
|
-RequestedNodeName $RequestedNodeName `
|
|
-DefaultNodeName $DefaultNodeName `
|
|
-MatrixNodeName $MatrixNodeName `
|
|
-ResultPath $sourceResultPath | Out-Null
|
|
|
|
$sourceFile = Join-Path $repoRoot $sourceResultPath
|
|
$sourceResult = Get-Content -Raw -Path $sourceFile | ConvertFrom-Json
|
|
$catalog = Get-PropertyValue -Item $sourceResult -Name "not_approved_outcome_operator_stop_status_catalog" -Default $null
|
|
$guardrails = Get-PropertyValue -Item $catalog -Name "guardrail_summary" -Default $null
|
|
|
|
$release = [ordered]@{
|
|
schema_version = "rap.remote_workspace_real_adapter_not_approved_outcome_operator_stop_status_catalog_release_marker.v1"
|
|
source_catalog_schema = Get-PropertyValue -Item $catalog -Name "schema_version" -Default $null
|
|
release_status = "operator_stop_status_catalog_released_contract_only"
|
|
release_marker = "c19z155_real_adapter_not_approved_outcome_operator_stop_status_catalog_release_marker"
|
|
catalog_status = Get-PropertyValue -Item $catalog -Name "catalog_status" -Default $null
|
|
catalog_entry_type = Get-PropertyValue -Item $catalog -Name "catalog_entry_type" -Default $null
|
|
operator_status = Get-PropertyValue -Item $catalog -Name "operator_status" -Default $null
|
|
operator_action = Get-PropertyValue -Item $catalog -Name "operator_action" -Default $null
|
|
display_severity = Get-PropertyValue -Item $catalog -Name "display_severity" -Default $null
|
|
next_allowed_entrypoint = Get-PropertyValue -Item $catalog -Name "next_allowed_entrypoint" -Default $null
|
|
attempt_allowed = $false
|
|
block_reason = Get-PropertyValue -Item $catalog -Name "block_reason" -Default $null
|
|
blocks_not_approved_extension = Get-PropertyValue -Item $catalog -Name "blocks_not_approved_extension" -Default $null
|
|
enablement_status = Get-PropertyValue -Item $catalog -Name "enablement_status" -Default $null
|
|
runtime_gate_state = Get-PropertyValue -Item $catalog -Name "runtime_gate_state" -Default $null
|
|
runtime_effect = Get-PropertyValue -Item $catalog -Name "runtime_effect" -Default $null
|
|
allows_process_start = $false
|
|
allows_payload_traffic = $false
|
|
guardrail_summary = $guardrails
|
|
release_notes = $requiredReleaseNotes
|
|
}
|
|
|
|
$releaseFieldsCompatible = Test-ObjectHasFields -Item $release -Fields $requiredReleaseFields
|
|
$releaseValuesCompatible = (
|
|
[string](Get-PropertyValue -Item $release -Name "schema_version" -Default "") -eq "rap.remote_workspace_real_adapter_not_approved_outcome_operator_stop_status_catalog_release_marker.v1" -and
|
|
[string](Get-PropertyValue -Item $release -Name "source_catalog_schema" -Default "") -eq "rap.remote_workspace_real_adapter_not_approved_outcome_operator_stop_status_catalog.v1" -and
|
|
[string](Get-PropertyValue -Item $release -Name "release_status" -Default "") -eq "operator_stop_status_catalog_released_contract_only" -and
|
|
[string](Get-PropertyValue -Item $release -Name "catalog_status" -Default "") -eq "operator_stop_status_catalog_complete" -and
|
|
[string](Get-PropertyValue -Item $release -Name "catalog_entry_type" -Default "") -eq "blocked_not_approved_operator_stop" -and
|
|
[string](Get-PropertyValue -Item $release -Name "operator_status" -Default "") -eq "not_approved_branch_closed_new_request_required" -and
|
|
[string](Get-PropertyValue -Item $release -Name "operator_action" -Default "") -eq "keep_real_adapter_disabled_until_new_explicit_enablement_request" -and
|
|
[string](Get-PropertyValue -Item $release -Name "display_severity" -Default "") -eq "blocked" -and
|
|
[string](Get-PropertyValue -Item $release -Name "next_allowed_entrypoint" -Default "") -eq "new_explicit_enablement_request_only" -and
|
|
-not [bool](Get-PropertyValue -Item $release -Name "attempt_allowed" -Default $true) -and
|
|
[string](Get-PropertyValue -Item $release -Name "block_reason" -Default "") -eq "new_explicit_enablement_request_required" -and
|
|
[bool](Get-PropertyValue -Item $release -Name "blocks_not_approved_extension" -Default $false) -and
|
|
[string](Get-PropertyValue -Item $release -Name "enablement_status" -Default "") -eq "not_enabled" -and
|
|
[string](Get-PropertyValue -Item $release -Name "runtime_gate_state" -Default "") -eq "validated_contract_only_not_enabled" -and
|
|
[string](Get-PropertyValue -Item $release -Name "runtime_effect" -Default "") -eq "contract_only_no_runtime_enablement" -and
|
|
-not [bool](Get-PropertyValue -Item $release -Name "allows_process_start" -Default $true) -and
|
|
-not [bool](Get-PropertyValue -Item $release -Name "allows_payload_traffic" -Default $true)
|
|
)
|
|
$releaseNotesCompatible = Test-ArrayContainsAll -Actual @($release.release_notes) -Expected $requiredReleaseNotes
|
|
$guardrailsCompatible = (
|
|
(Test-ObjectHasFields -Item $guardrails -Fields $requiredGuardrailFields) -and
|
|
[bool](Get-PropertyValue -Item $guardrails -Name "activation_blocked" -Default $false) -and
|
|
-not [bool](Get-PropertyValue -Item $guardrails -Name "process_start_allowed" -Default $true) -and
|
|
-not [bool](Get-PropertyValue -Item $guardrails -Name "health_probe_enabled" -Default $true) -and
|
|
[string](Get-PropertyValue -Item $guardrails -Name "payload_traffic" -Default "") -eq "none" -and
|
|
-not [bool](Get-PropertyValue -Item $guardrails -Name "allows_process_start" -Default $true) -and
|
|
-not [bool](Get-PropertyValue -Item $guardrails -Name "allows_payload_traffic" -Default $true)
|
|
)
|
|
|
|
$checks = [ordered]@{
|
|
source_smoke_passed = ([bool]$sourceResult.passed)
|
|
source_schema_expected = ([string]$sourceResult.schema_version -eq "c19z154.remote_workspace_real_adapter_not_approved_outcome_operator_stop_status_catalog_compatibility_smoke.v1")
|
|
catalog_present = ($null -ne $catalog)
|
|
release_fields_compatible = $releaseFieldsCompatible
|
|
release_values_compatible = $releaseValuesCompatible
|
|
release_notes_compatible = $releaseNotesCompatible
|
|
guardrails_compatible = $guardrailsCompatible
|
|
}
|
|
$failed = @($checks.GetEnumerator() | Where-Object { -not $_.Value } | ForEach-Object { $_.Key })
|
|
|
|
$result = [ordered]@{
|
|
schema_version = "c19z155.remote_workspace_real_adapter_not_approved_outcome_operator_stop_status_catalog_release_marker_smoke.v1"
|
|
source_result_path = $sourceFile
|
|
cluster_id = $ClusterID
|
|
required_release_fields = $requiredReleaseFields
|
|
required_guardrail_fields = $requiredGuardrailFields
|
|
required_release_notes = $requiredReleaseNotes
|
|
not_approved_outcome_operator_stop_status_catalog_release_marker = $release
|
|
checks = $checks
|
|
failed_checks = $failed
|
|
passed = ($failed.Count -eq 0)
|
|
}
|
|
|
|
$fullResultPath = Join-Path $repoRoot $ResultPath
|
|
$resultDir = Split-Path -Parent $fullResultPath
|
|
if ($resultDir) { New-Item -ItemType Directory -Force -Path $resultDir | Out-Null }
|
|
$result | ConvertTo-Json -Depth 100 | Set-Content -Encoding UTF8 -Path $fullResultPath
|
|
|
|
if (-not $result.passed) {
|
|
throw "C19Z155 remote workspace real-adapter not-approved outcome operator stop status catalog release marker smoke failed. Result: $fullResultPath Failed: $($failed -join ', ')"
|
|
}
|
|
|
|
Write-Host "C19Z155 remote workspace real-adapter not-approved outcome operator stop status catalog release marker smoke passed. Result: $fullResultPath"
|
|
$result
|