ЛР6: наблюдаемость, SLO и диагностика отказов
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Set-Location (Split-Path $PSScriptRoot -Parent)
|
||||
$env:BASE_URL = 'http://127.0.0.1:18085'
|
||||
$env:PYTHONPATH = (Resolve-Path tests).Path
|
||||
$base = @('compose', '-f', 'docker-compose.yml', '-f', 'compose.local.yaml')
|
||||
$proof = $base + @('-f', 'compose.test.yaml')
|
||||
|
||||
function Invoke-Checked {
|
||||
param([string]$Name, [string]$Command, [string[]]$Arguments)
|
||||
& $Command @Arguments *> "evidence/$Name.txt"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Get-Content "evidence/$Name.txt" -Tail 25
|
||||
throw "$Name failed ($LASTEXITCODE)"
|
||||
}
|
||||
Write-Host "PASS $Name"
|
||||
}
|
||||
|
||||
function Wait-Api {
|
||||
py -c "import sys; sys.path.insert(0,'student-tests'); from pipeline_support import ready_api; ready_api()"
|
||||
if ($LASTEXITCODE -ne 0) { throw 'API readiness not confirmed' }
|
||||
}
|
||||
|
||||
try {
|
||||
Invoke-Checked 'contract-check' 'py' @('scripts/check_contract.py')
|
||||
Invoke-Checked 'openapi-validation' 'py' @('scripts/validate_openapi.py')
|
||||
Invoke-Checked 'style' 'py' @('scripts/style.py')
|
||||
Invoke-Checked 'java-build' '.\gradlew.bat' @('test', '--no-daemon')
|
||||
Invoke-Checked 'stack-test-profile' 'docker' ($proof + @('up', '-d', '--build'))
|
||||
Wait-Api
|
||||
Invoke-Checked 'smoke' 'py' @('tests/smoke.py')
|
||||
Invoke-Checked 'observe' 'py' @('student-tests/observe.py')
|
||||
foreach ($name in @('core','faults','retention','boundaries','ack_guard','filename','upload_crash','history_capacity')) {
|
||||
Invoke-Checked "pipeline-$name" 'py' @("student-tests/pipeline_$name.py")
|
||||
}
|
||||
Invoke-Checked 'stack-ordinary' 'docker' ($base + @('up', '-d'))
|
||||
Wait-Api
|
||||
Invoke-Checked 'incidents' 'py' @('student-tests/incidents.py')
|
||||
Invoke-Checked 'load' 'py' @('tests/load.py', '--duration', '30', '--concurrency', '4', '--output', 'evidence/load.json')
|
||||
Invoke-Checked 'persistence' 'py' @('tests/resilience.py', '--mode', 'persistence', '--action-script', 'scripts/restart.cmd')
|
||||
Wait-Api
|
||||
Invoke-Checked 'failover' 'py' @('tests/resilience.py', '--mode', 'failover', '--action-script', 'scripts/stop-one.cmd')
|
||||
Invoke-Checked 'stack-final' 'docker' ($base + @('up', '-d', 'api'))
|
||||
Wait-Api
|
||||
Invoke-Checked 'environment' 'py' @('scripts/capture_evidence.py')
|
||||
} finally {
|
||||
docker @base up -d
|
||||
}
|
||||
Reference in New Issue
Block a user