@@ -35,10 +35,21 @@ docker-compose -p projectvg-loadtest --env-file env.loadtest -f docker-compose.l
35
35
36
36
# Wait for services to start
37
37
Write-Host " Waiting for services to start..." - ForegroundColor Yellow
38
- Start-Sleep - Seconds 3
39
38
40
- # Check service status
41
- Write-Host " Checking service status..." - ForegroundColor Yellow
39
+ function Wait-ForUrl {
40
+ param ([string ]$url , [int ]$timeoutSec = 120 )
41
+ $stopwatch = [System.Diagnostics.Stopwatch ]::StartNew()
42
+ while ($stopwatch.Elapsed.TotalSeconds -lt $timeoutSec ) {
43
+ try {
44
+ $resp = Invoke-WebRequest - Uri $url - TimeoutSec 3 - UseBasicParsing
45
+ if ($resp.StatusCode -eq 200 ) { return $true }
46
+ } catch { Start-Sleep - Milliseconds 500 }
47
+ }
48
+ return $false
49
+ }
50
+
51
+ # Check service status with retry
52
+ Write-Host " Checking service status with retry..." - ForegroundColor Yellow
42
53
43
54
$services = @ (
44
55
@ {Name = " LLM Server" ; Url = " http://localhost:7808/health" },
@@ -49,16 +60,13 @@ $services = @(
49
60
50
61
$allHealthy = $true
51
62
foreach ($service in $services ) {
52
- try {
53
- $response = Invoke-RestMethod - Uri $service.Url - TimeoutSec 3
54
- if ($response.status -eq " ok" -or $response.Status -eq " Healthy" ) {
55
- Write-Host " $ ( $service.Name ) : OK" - ForegroundColor Green
56
- } else {
57
- Write-Host " $ ( $service.Name ) : FAILED" - ForegroundColor Red
58
- $allHealthy = $false
59
- }
60
- } catch {
61
- Write-Host " $ ( $service.Name ) : CONNECTION FAILED" - ForegroundColor Red
63
+ Write-Host " Waiting for $ ( $service.Name ) ..." - ForegroundColor Cyan
64
+ $isHealthy = Wait-ForUrl - url $service.Url - timeoutSec 120
65
+
66
+ if ($isHealthy ) {
67
+ Write-Host " $ ( $service.Name ) : OK" - ForegroundColor Green
68
+ } else {
69
+ Write-Host " $ ( $service.Name ) : TIMEOUT (120s)" - ForegroundColor Red
62
70
$allHealthy = $false
63
71
}
64
72
}
0 commit comments