Add EveUnity capture request contract
This commit is contained in:
parent
e64e659f17
commit
ce7a7040c8
13 changed files with 353 additions and 10 deletions
99
scripts/run-eveunity-capture-contract-smoke.ps1
Normal file
99
scripts/run-eveunity-capture-contract-smoke.ps1
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
param(
|
||||
[string] $CapabilityManifestPath = "packages\org.gamecult.eve.unity-uitoolkit\eve-runtime-capability.json",
|
||||
[string] $AdvertisementPath = "web\fixtures\aetheria.provider-advertisement.json",
|
||||
[string] $OutputPath = "artifacts\eveunity-uitoolkit-capture-contract\latest\capture-request.json",
|
||||
[string] $Stamp = "smoke"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$absoluteCapabilityPath = if ([System.IO.Path]::IsPathRooted($CapabilityManifestPath)) {
|
||||
$CapabilityManifestPath
|
||||
} else {
|
||||
Join-Path $projectRoot $CapabilityManifestPath
|
||||
}
|
||||
$absoluteAdvertisementPath = if ([System.IO.Path]::IsPathRooted($AdvertisementPath)) {
|
||||
$AdvertisementPath
|
||||
} else {
|
||||
Join-Path $projectRoot $AdvertisementPath
|
||||
}
|
||||
$absoluteOutputPath = if ([System.IO.Path]::IsPathRooted($OutputPath)) {
|
||||
$OutputPath
|
||||
} else {
|
||||
Join-Path $projectRoot $OutputPath
|
||||
}
|
||||
|
||||
foreach ($path in @($absoluteCapabilityPath, $absoluteAdvertisementPath)) {
|
||||
if (-not (Test-Path -LiteralPath $path)) {
|
||||
throw "EveUnity capture contract input not found: $path"
|
||||
}
|
||||
}
|
||||
|
||||
$manifest = Get-Content -LiteralPath $absoluteCapabilityPath -Raw | ConvertFrom-Json
|
||||
$captureContract = $manifest.lifecycle.capture.captureContract
|
||||
if ($null -eq $captureContract) {
|
||||
throw "EveUnity capture contract missing lifecycle.capture.captureContract"
|
||||
}
|
||||
foreach ($field in @("ownerRepo", "runtimeId", "targetId", "requestSchema", "requestBuilder", "advertisementPath", "captureKind", "artifactKind", "artifactPattern", "conformanceAttachment", "requiredProvider", "requiredSurface", "authority", "publishProof")) {
|
||||
if (-not $captureContract.$field) {
|
||||
throw "EveUnity capture contract missing $field"
|
||||
}
|
||||
}
|
||||
if ($captureContract.ownerRepo -ne "EveUnity") {
|
||||
throw "Unexpected EveUnity capture owner: $($captureContract.ownerRepo)"
|
||||
}
|
||||
if ($captureContract.runtimeId -ne "unity-uitoolkit") {
|
||||
throw "Unexpected EveUnity capture runtime: $($captureContract.runtimeId)"
|
||||
}
|
||||
if ($captureContract.targetId -ne "unity-uitoolkit") {
|
||||
throw "Unexpected EveUnity capture target: $($captureContract.targetId)"
|
||||
}
|
||||
if ($captureContract.requestSchema -ne "gamecult.eve.runtime_capture_request.v1") {
|
||||
throw "Unexpected EveUnity capture request schema: $($captureContract.requestSchema)"
|
||||
}
|
||||
|
||||
$builderPath = Join-Path $projectRoot $captureContract.requestBuilder
|
||||
if (-not (Test-Path -LiteralPath $builderPath)) {
|
||||
throw "EveUnity capture request builder not found: $($captureContract.requestBuilder)"
|
||||
}
|
||||
if ((Join-Path $projectRoot $captureContract.advertisementPath) -ne $absoluteAdvertisementPath) {
|
||||
throw "EveUnity capture advertisement path mismatch: $($captureContract.advertisementPath) vs $AdvertisementPath"
|
||||
}
|
||||
|
||||
node --test (Join-Path $projectRoot "tools\eveunity\eveunity-capture-contract.test.mjs")
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveUnity capture contract tests failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
node $builderPath --capability $absoluteCapabilityPath --advertisement $absoluteAdvertisementPath --output $absoluteOutputPath --stamp $Stamp
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveUnity capture request builder failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $absoluteOutputPath)) {
|
||||
throw "EveUnity capture request was not written: $absoluteOutputPath"
|
||||
}
|
||||
|
||||
$request = Get-Content -LiteralPath $absoluteOutputPath -Raw | ConvertFrom-Json
|
||||
foreach ($expectation in @(
|
||||
@{ field = "schema"; value = "gamecult.eve.runtime_capture_request.v1" },
|
||||
@{ field = "runtimeId"; value = "unity-uitoolkit" },
|
||||
@{ field = "ownerRepo"; value = "EveUnity" },
|
||||
@{ field = "providerId"; value = "aetheria" },
|
||||
@{ field = "surfaceId"; value = "aetheria.daemon.game" },
|
||||
@{ field = "targetId"; value = "unity-uitoolkit" },
|
||||
@{ field = "commandBoundary"; value = "aetheria.daemon.commands" },
|
||||
@{ field = "receiptSchema"; value = "aetheria.eve_command_acceptance_status.v1" },
|
||||
@{ field = "captureKind"; value = "unity-editor-or-batchmode-png" },
|
||||
@{ field = "artifactKind"; value = "png" },
|
||||
@{ field = "conformanceAttachment"; value = "runtime.captureArtifacts[]" }
|
||||
)) {
|
||||
if ($request.($expectation.field) -ne $expectation.value) {
|
||||
throw "EveUnity capture request $($expectation.field) expected $($expectation.value) got $($request.($expectation.field))"
|
||||
}
|
||||
}
|
||||
if ($request.artifactPath -ne "artifacts/eveunity-uitoolkit-capture/$Stamp/unity-uitoolkit.png") {
|
||||
throw "Unexpected EveUnity capture artifact path: $($request.artifactPath)"
|
||||
}
|
||||
|
||||
Write-Host "EveUnity capture contract smoke passed: $absoluteOutputPath"
|
||||
|
|
@ -168,17 +168,35 @@ if ($captureContract.ownerRepo -ne "EveUnity") {
|
|||
if ($captureContract.runtimeId -ne "unity-uitoolkit") {
|
||||
throw "EveUnity capture contract has unexpected runtime: $($captureContract.runtimeId)"
|
||||
}
|
||||
if ($captureContract.targetId -ne "unity-uitoolkit") {
|
||||
throw "EveUnity capture contract has unexpected target: $($captureContract.targetId)"
|
||||
}
|
||||
if ($captureContract.requestSchema -ne "gamecult.eve.runtime_capture_request.v1") {
|
||||
throw "EveUnity capture contract has unexpected request schema: $($captureContract.requestSchema)"
|
||||
}
|
||||
if ($captureContract.captureKind -ne "unity-editor-or-batchmode-png") {
|
||||
throw "EveUnity capture contract has unexpected capture kind: $($captureContract.captureKind)"
|
||||
}
|
||||
if ($captureContract.artifactKind -ne "png") {
|
||||
throw "EveUnity capture contract has unexpected artifact kind: $($captureContract.artifactKind)"
|
||||
}
|
||||
foreach ($field in @("artifactPattern", "conformanceAttachment", "requiredProvider", "requiredSurface", "authority", "publishProof")) {
|
||||
foreach ($field in @("requestBuilder", "advertisementPath", "artifactPattern", "conformanceAttachment", "requiredProvider", "requiredSurface", "authority", "publishProof")) {
|
||||
if (-not $captureContract.$field) {
|
||||
throw "EveUnity capture contract missing $field"
|
||||
}
|
||||
}
|
||||
foreach ($pathProperty in @("requestBuilder", "advertisementPath")) {
|
||||
$relativePath = $captureContract.$pathProperty
|
||||
$absolutePath = Join-Path $projectRoot $relativePath
|
||||
if (-not (Test-Path -LiteralPath $absolutePath)) {
|
||||
throw "EveUnity capture contract $pathProperty does not exist: $relativePath"
|
||||
}
|
||||
}
|
||||
|
||||
& (Join-Path $projectRoot "scripts\run-eveunity-capture-contract-smoke.ps1")
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveUnity capture contract smoke failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
& (Join-Path $projectRoot "scripts\run-aetheria-unity-package-smoke.ps1")
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
|
|
|
|||
|
|
@ -117,6 +117,10 @@ node $consumerScript $consumerExport `
|
|||
--expect-runtime-lifecycle-field "unity-uitoolkit:test:testContract.testPlatform:EditMode" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:capture:captureContract.captureKind:unity-editor-or-batchmode-png" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:capture:captureContract.artifactKind:png" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:capture:captureContract.targetId:unity-uitoolkit" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:capture:captureContract.requestSchema:gamecult.eve.runtime_capture_request.v1" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:capture:captureContract.requestBuilder:tools/eveunity/eveunity-capture-contract.mjs" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:capture:captureContract.advertisementPath:web/fixtures/aetheria.provider-advertisement.json" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:capture:captureContract.conformanceAttachment:runtime.captureArtifacts[]" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:capture:captureContract.requiredProvider:aetheria" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:capture:captureContract.requiredSurface:aetheria.daemon.game" `
|
||||
|
|
|
|||
Loading…
Reference in a new issue