# Service Verification Script Write-Host "`n========================================" -ForegroundColor Cyan Write-Host " SERVICE VERIFICATION" -ForegroundColor Cyan Write-Host "========================================`n" -ForegroundColor Cyan $allPassed = $true # Test 1: Orchestrator Health Write-Host "1. Orchestrator Health Check" -ForegroundColor Yellow try { $health = Invoke-WebRequest -Uri "http://localhost:8080/health" -TimeoutSec 5 -UseBasicParsing $data = $health.Content | ConvertFrom-Json Write-Host " [OK] Status: $($data.status)" -ForegroundColor Green Write-Host " Database: $($data.checks.database)" -ForegroundColor $(if ($data.checks.database -eq "up") { "Green" } else { "Yellow" }) } catch { Write-Host " [FAIL] $($_.Exception.Message)" -ForegroundColor Red $allPassed = $false } # Test 2: Orchestrator Metrics Write-Host "`n2. Orchestrator Metrics" -ForegroundColor Yellow try { $metrics = Invoke-WebRequest -Uri "http://localhost:8080/metrics" -TimeoutSec 5 -UseBasicParsing if ($metrics.StatusCode -eq 200) { Write-Host " [OK] Metrics endpoint working" -ForegroundColor Green } } catch { Write-Host " [FAIL] $($_.Exception.Message)" -ForegroundColor Red $allPassed = $false } # Test 3: Orchestrator Liveness Write-Host "`n3. Orchestrator Liveness" -ForegroundColor Yellow try { $live = Invoke-WebRequest -Uri "http://localhost:8080/live" -TimeoutSec 5 -UseBasicParsing $data = $live.Content | ConvertFrom-Json if ($data.alive) { Write-Host " [OK] Service is alive" -ForegroundColor Green } } catch { Write-Host " [FAIL] $($_.Exception.Message)" -ForegroundColor Red $allPassed = $false } # Test 4: Webapp Status Write-Host "`n4. Webapp Status" -ForegroundColor Yellow try { $webapp = Invoke-WebRequest -Uri "http://localhost:3000" -TimeoutSec 10 -UseBasicParsing if ($webapp.StatusCode -eq 200 -and $webapp.Content.Length -gt 1000) { Write-Host " [OK] Webapp is serving content ($($webapp.Content.Length) bytes)" -ForegroundColor Green } else { Write-Host " [WARN] Webapp responded but content may be incomplete" -ForegroundColor Yellow } } catch { Write-Host " [WARN] Webapp timeout (may still be compiling): $($_.Exception.Message)" -ForegroundColor Yellow } # Test 5: API Endpoints Write-Host "`n5. API Endpoints" -ForegroundColor Yellow $endpoints = @( @{ Name = "Root"; URL = "http://localhost:8080"; Expected = 404 }, @{ Name = "Health"; URL = "http://localhost:8080/health"; Expected = 200 }, @{ Name = "Metrics"; URL = "http://localhost:8080/metrics"; Expected = 200 }, @{ Name = "Live"; URL = "http://localhost:8080/live"; Expected = 200 } ) foreach ($endpoint in $endpoints) { try { $response = Invoke-WebRequest -Uri $endpoint.URL -TimeoutSec 3 -UseBasicParsing if ($response.StatusCode -eq $endpoint.Expected -or ($endpoint.Expected -eq 404 -and $response.StatusCode -eq 404)) { Write-Host " [OK] $($endpoint.Name): $($response.StatusCode)" -ForegroundColor Green } else { Write-Host " [WARN] $($endpoint.Name): $($response.StatusCode) (expected $($endpoint.Expected))" -ForegroundColor Yellow } } catch { if ($_.Exception.Response.StatusCode -eq $endpoint.Expected) { Write-Host " [OK] $($endpoint.Name): $($endpoint.Expected)" -ForegroundColor Green } else { Write-Host " [FAIL] $($endpoint.Name): $($_.Exception.Message)" -ForegroundColor Red $allPassed = $false } } } # Summary Write-Host "`n========================================" -ForegroundColor Cyan if ($allPassed) { Write-Host " [OK] All critical services verified" -ForegroundColor Green } else { Write-Host " [WARN] Some services need attention" -ForegroundColor Yellow } Write-Host "========================================`n" -ForegroundColor Cyan