Files
mtusi2026lab3/scripts/rolling-update.bat
2026-10-21 13:31:36 +03:00

45 lines
1.2 KiB
Batchfile

@echo off
setlocal
echo === Rolling Update Test ===
echo.
:: Устанавливаем UTF-8 для Python (ВАЖНО!)
set PYTHONUTF8=1
:: Запускаем нагрузочный тест в фоне
echo Starting load test in background...
start /b python tests/load.py --base-url http://localhost:8080 --duration 60 --concurrency 8 --output metrics-rolling.json
:: Ждём 5 секунд
echo Waiting for load to stabilize...
timeout /t 5 /nobreak >nul
:: Выполняем rolling update
echo.
echo === Performing rolling update ===
docker compose up -d --build api
:: Ждём завершения обновления
echo Waiting for all replicas to become healthy...
:wait_healthy
timeout /t 2 /nobreak >nul
docker compose ps api | findstr "healthy" | find /c "healthy" | findstr "2" >nul
if errorlevel 1 goto :wait_healthy
echo All replicas are healthy!
:: Ждём завершения нагрузочного теста
echo.
echo Waiting for load test to complete...
timeout /t 30 /nobreak >nul
echo.
echo === Rolling update completed ===
if exist metrics-rolling.json (
echo Metrics saved to metrics-rolling.json
type metrics-rolling.json
) else (
echo WARNING: metrics-rolling.json not found!
)
endlocal