Skip to content

Commit e1a740c

Browse files
committed
fix(ci): increase HTTP test timeouts and use 127.0.0.1
The CI HTTP server tests (go-http, dotnet-http) were failing because Invoke-WebRequest -TimeoutSec 2 sent RST before the server could process the connection through the hostsock sleep-rescan cycle. Use 127.0.0.1 to avoid IPv6 resolution, increase per-request timeout to 10s, and add an initial delay for the unikernel to boot. Signed-off-by: danbugs <danilochiarlone@gmail.com>
1 parent 4d93597 commit e1a740c

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

.github/workflows/test-examples.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -357,20 +357,21 @@ jobs:
357357
fi
358358
hyperlight-unikraft -q $mem_args "$kernel" --initrd "$cpio" ${{ matrix.args }} &
359359
server_pid=$!
360+
sleep 3
360361
ready=0
361362
for i in $(seq 1 30); do
362-
if curl -s --max-time 2 "http://localhost:${http_port}" >/dev/null 2>&1; then
363+
if curl -s --max-time 10 "http://127.0.0.1:${http_port}" >/dev/null 2>&1; then
363364
ready=1
364365
break
365366
fi
366367
sleep 1
367368
done
368369
if [ "$ready" -ne 1 ]; then
369-
echo "FAIL: server did not become ready within 30s"
370+
echo "FAIL: server did not become ready within timeout"
370371
kill "$server_pid" 2>/dev/null || true
371372
exit 1
372373
fi
373-
response=$(curl -s --max-time 5 "http://localhost:${http_port}")
374+
response=$(curl -s --max-time 10 "http://127.0.0.1:${http_port}")
374375
kill "$server_pid" 2>/dev/null || true
375376
wait "$server_pid" 2>/dev/null || true
376377
echo "=== HTTP response ==="
@@ -644,8 +645,6 @@ jobs:
644645

645646
- name: Run and check output
646647
shell: pwsh
647-
env:
648-
HL_DISPATCH_DEBUG: "1"
649648
run: |
650649
$kernel = (Resolve-Path "image/kernel").Path
651650
$cpio = (Resolve-Path "image/initrd.cpio").Path
@@ -694,24 +693,26 @@ jobs:
694693
$proc = Start-Process -FilePath 'hyperlight-unikraft' `
695694
-ArgumentList (@('-q') + $memArgs + @($kernel, '--initrd', $cpio) + $argList) `
696695
-PassThru -NoNewWindow -RedirectStandardError $stderrLog
696+
# Give the server time to boot the unikernel and start listening
697+
Start-Sleep -Seconds 5
697698
$ready = $false
698699
for ($i = 0; $i -lt 30; $i++) {
699700
try {
700-
$null = Invoke-WebRequest -Uri "http://localhost:${httpPort}" -UseBasicParsing -TimeoutSec 2 -ErrorAction Stop
701+
$null = Invoke-WebRequest -Uri "http://127.0.0.1:${httpPort}" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop
701702
$ready = $true
702703
break
703704
} catch {
704705
Start-Sleep -Seconds 1
705706
}
706707
}
707708
if (-not $ready) {
708-
Write-Host "FAIL: server did not become ready within 30s"
709-
Write-Host "=== stderr (last 50 lines) ==="
710-
Get-Content $stderrLog -Tail 50 -ErrorAction SilentlyContinue
709+
Write-Host "FAIL: server did not become ready within timeout"
710+
Write-Host "=== stderr (last 200 lines) ==="
711+
Get-Content $stderrLog -Tail 200 -ErrorAction SilentlyContinue
711712
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
712713
exit 1
713714
}
714-
$resp = (Invoke-WebRequest -Uri "http://localhost:${httpPort}" -UseBasicParsing -TimeoutSec 5).Content
715+
$resp = (Invoke-WebRequest -Uri "http://127.0.0.1:${httpPort}" -UseBasicParsing -TimeoutSec 10).Content
715716
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
716717
Write-Host "=== HTTP response ==="
717718
Write-Host $resp

0 commit comments

Comments
 (0)