This commit is contained in:
@@ -22,6 +22,21 @@ function Post-ContinuityJson([string]$url, [object]$body) {
|
||||
}
|
||||
}
|
||||
|
||||
function Post-CoreJson([string]$url, [object]$body) {
|
||||
$json = $body | ConvertTo-Json -Depth 8 -Compress
|
||||
$local = New-TemporaryFile
|
||||
$remote = "/tmp/domovoy-$([guid]::NewGuid().ToString('N')).json"
|
||||
try {
|
||||
[IO.File]::WriteAllText($local, $json, [Text.UTF8Encoding]::new($false))
|
||||
docker --context $DockerContext cp $local "${coreContainer}:$remote" | Out-Null
|
||||
docker --context $DockerContext exec $coreContainer wget -qO- --header "Content-Type: application/json" --post-file $remote $url
|
||||
if ($LASTEXITCODE -ne 0) { throw "Core fixture creation failed" }
|
||||
} finally {
|
||||
docker --context $DockerContext exec --user root $coreContainer rm -f $remote 2>$null
|
||||
Remove-Item -LiteralPath $local -Force
|
||||
}
|
||||
}
|
||||
|
||||
$health = Invoke-RestMethod -Uri "$BaseURL/healthz" -Method Get
|
||||
if ($health.status -ne "ok" -or $health.runtime -ne "creator-web") { throw "Creator web health response is invalid" }
|
||||
|
||||
@@ -61,4 +76,24 @@ $prospectiveList = Invoke-RestMethod -Uri "$BaseURL/api/prospective-items?limit=
|
||||
if (-not $prospectiveList.Items -or $prospectiveList.Items.Count -gt 25) { throw "ProspectiveItem register response is invalid" }
|
||||
if ($prospectiveList.Items | Where-Object OwnerPrincipalID -ne "domovoy-creator-principal") { throw "ProspectiveItem register leaked another Principal" }
|
||||
|
||||
Write-Output "DEV-000029 Creator Continuity register: PASS"
|
||||
$actionGoal = "web-action-goal-$suffix"
|
||||
$actionTask = "web-action-task-$suffix"
|
||||
$actionItem = "web-action-item-$suffix"
|
||||
Post-CoreJson "http://localhost:8080/v1/tasks" @{TaskID=$actionTask;GoalID=$actionGoal;ScopeID="domovoy-global-scope";Revision=1}
|
||||
Post-ContinuityJson "http://localhost:8081/v1/prospective-items" @{
|
||||
ID=$actionItem;CommitmentID="web-action-commitment-$suffix";OwnerPrincipalID="domovoy-creator-principal"
|
||||
ScopeID="domovoy-global-scope";GoalID=$actionGoal;TriggerAtUnixMillis=1800000000000
|
||||
State="DELIVERED";Revision=1
|
||||
}
|
||||
$actionCommand = @{
|
||||
Target=@{TaskID=$actionTask;GoalID=$actionGoal;ScopeID="domovoy-global-scope";Revision=1}
|
||||
ProspectiveItemID=$actionItem;ExpectedRevision=1;EvidenceRef="artifact://creator-web/$suffix"
|
||||
} | ConvertTo-Json -Depth 8
|
||||
$actionResult = Invoke-RestMethod -Uri "$BaseURL/api/actions/satisfy-delivered" -Method Post -ContentType "application/json" -Headers @{Authorization="Bearer $($issued.Token)"} -Body $actionCommand
|
||||
if ($actionResult.State -ne "SUCCEEDED" -or -not $actionResult.AuthorizedActionID -or -not $actionResult.ActionAttemptID) { throw "Creator action gateway response is invalid" }
|
||||
$staleAction = Invoke-WebRequest -Uri "$BaseURL/api/actions/satisfy-delivered" -Method Post -ContentType "application/json" -Headers @{Authorization="Bearer $($issued.Token)"} -Body $actionCommand -SkipHttpErrorCheck
|
||||
if ($staleAction.StatusCode -ne 409) { throw "Stale Creator action was not rejected" }
|
||||
$arbitraryAction = Invoke-WebRequest -Uri "$BaseURL/api/actions/arbitrary" -Method Post -ContentType "application/json" -Headers @{Authorization="Bearer $($issued.Token)"} -Body '{}' -SkipHttpErrorCheck
|
||||
if ($arbitraryAction.StatusCode -ne 404) { throw "Arbitrary action route was exposed" }
|
||||
|
||||
Write-Output "DEV-000032 Creator satisfaction console gateway: PASS"
|
||||
|
||||
Reference in New Issue
Block a user