uchill/backend/scripts/test_endpoints_performance.ps1

47 lines
1.8 KiB
PowerShell

# PowerShell скрипт для тестирования производительности основных endpoints
# Использование: .\scripts\test_endpoints_performance.ps1
Write-Host "==================================" -ForegroundColor Green
Write-Host "⚡ Тестирование производительности API" -ForegroundColor Green
Write-Host "==================================" -ForegroundColor Green
Write-Host ""
Set-Location backend
# Список endpoints для тестирования
$endpoints = @(
"/api/users/mentor/dashboard/",
"/api/analytics/overview/?period=month",
"/api/analytics/detailed_lessons/?period=month",
"/api/analytics/comparison/?period=month",
"/api/analytics/time_series/?period=month&group_by=day",
"/api/analytics/revenue/?period=month",
"/api/users/profile/me/",
"/api/homework/homeworks/"
)
$email = if ($args[0]) { $args[0] } else { "mentor@test.com" }
$iterations = if ($args[1]) { $args[1] } else { 5 }
Write-Host "📧 Email: $email" -ForegroundColor Cyan
Write-Host "🔄 Итераций: $iterations" -ForegroundColor Cyan
Write-Host ""
foreach ($endpoint in $endpoints) {
Write-Host "==================================" -ForegroundColor Yellow
Write-Host "Тестирую: $endpoint" -ForegroundColor Yellow
Write-Host "==================================" -ForegroundColor Yellow
python manage.py benchmark_api `
--endpoint $endpoint `
--email $email `
--iterations $iterations
Write-Host ""
}
Write-Host "==================================" -ForegroundColor Green
Write-Host "✅ Тестирование завершено" -ForegroundColor Green
Write-Host "==================================" -ForegroundColor Green
Set-Location ..