forked from mtusi2026/mtusi2026lab6
исправлены тесты и сценарии отказов
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
if (-not $env:TARGET_INSTANCE_ID) {
|
||||
Write-Error "TARGET_INSTANCE_ID is required"
|
||||
exit 1
|
||||
}
|
||||
Set-Location (Join-Path $PSScriptRoot "..")
|
||||
$ids = docker compose --env-file .env ps -q api
|
||||
$found = $false
|
||||
foreach ($id in $ids) {
|
||||
if (-not $id) { continue }
|
||||
$iid = ""
|
||||
try { $iid = (docker exec $id cat /tmp/instance-id).Trim() } catch { $iid = "" }
|
||||
$hostName = (docker inspect -f "{{.Config.Hostname}}" $id).Trim()
|
||||
if ($iid -eq $env:TARGET_INSTANCE_ID -or $hostName -eq $env:TARGET_INSTANCE_ID) {
|
||||
docker stop -t 5 $id | Out-Null
|
||||
$found = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (-not $found) {
|
||||
Write-Error "no running API replica matched TARGET_INSTANCE_ID"
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user