feat: initialize independent Sense product skeleton (#21)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$expectedGo = 'go version go1.26.5 windows/amd64'
|
||||
$actualGo = (& go version).Trim()
|
||||
if ($actualGo -ne $expectedGo) {
|
||||
throw "Go toolchain mismatch. Expected '$expectedGo', got '$actualGo'."
|
||||
}
|
||||
|
||||
$actualNode = (& node --version).Trim()
|
||||
if ($actualNode -ne 'v22.22.1') {
|
||||
throw "Node.js mismatch. Expected 'v22.22.1', got '$actualNode'."
|
||||
}
|
||||
|
||||
$actualPnpm = (& corepack pnpm@9.15.1 --version).Trim()
|
||||
if ($actualPnpm -ne '9.15.1') {
|
||||
throw "pnpm mismatch. Expected '9.15.1', got '$actualPnpm'."
|
||||
}
|
||||
|
||||
Write-Output 'Sense toolchain matches goadmin-baseline.json.'
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$senseRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
||||
$serverRoot = Join-Path $senseRoot 'server'
|
||||
$env:SENSE_DATABASE_MODE = 'memory'
|
||||
$env:SENSE_HTTP_ADDRESS = '127.0.0.1:18080'
|
||||
|
||||
$process = Start-Process -FilePath 'go' -ArgumentList @('run', '.') -WorkingDirectory $serverRoot -PassThru -WindowStyle Hidden
|
||||
try {
|
||||
$ready = $false
|
||||
for ($attempt = 0; $attempt -lt 30; $attempt++) {
|
||||
try {
|
||||
$health = Invoke-RestMethod -Uri 'http://127.0.0.1:18080/healthz' -TimeoutSec 1
|
||||
$readiness = Invoke-RestMethod -Uri 'http://127.0.0.1:18080/readyz' -TimeoutSec 1
|
||||
if ($health.status -eq 'ok' -and $readiness.status -eq 'ready') {
|
||||
$ready = $true
|
||||
break
|
||||
}
|
||||
} catch {
|
||||
Start-Sleep -Milliseconds 250
|
||||
}
|
||||
}
|
||||
if (-not $ready) {
|
||||
throw 'Sense smoke server did not become ready.'
|
||||
}
|
||||
|
||||
try {
|
||||
Invoke-WebRequest -Uri 'http://127.0.0.1:18080/api/v1/demo' -TimeoutSec 2 | Out-Null
|
||||
throw 'Disabled demo route unexpectedly returned success.'
|
||||
} catch {
|
||||
if ($_.Exception.Response.StatusCode.value__ -ne 404) { throw }
|
||||
}
|
||||
Write-Output 'Sense independent smoke test passed.'
|
||||
} finally {
|
||||
if (-not $process.HasExited) { Stop-Process -Id $process.Id }
|
||||
$process.WaitForExit()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user