windows try/fix

This commit is contained in:
jasonwitty 2025-08-20 15:20:07 -07:00
parent b80d322650
commit 5f10e34341

View File

@ -29,29 +29,27 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
# Start the already-built release binary to avoid rebuild delays # Start the already-built release binary to avoid rebuild delays
# Force TLS off for this probe # Force TLS off for this probe and disable slow/fragile sensors
RUST_LOG=info SOCKTOP_ENABLE_SSL=0 ./target/release/socktop_agent -p 3000 > agent.log 2>&1 & RUST_LOG=info SOCKTOP_ENABLE_SSL=0 SOCKTOP_AGENT_GPU=0 SOCKTOP_AGENT_TEMP=0 ./target/release/socktop_agent -p 3000 > agent.log 2>&1 &
AGENT_PID=$! AGENT_PID=$!
echo "AGENT_PID=$AGENT_PID" >> $GITHUB_ENV echo "AGENT_PID=$AGENT_PID" >> $GITHUB_ENV
echo "SOCKTOP_PORT=3000" >> $GITHUB_ENV
echo "SOCKTOP_WS=ws://127.0.0.1:3000/ws" >> $GITHUB_ENV
# Wait for /healthz to return 200 (60s max) # Wait for /healthz to return 200 (60s max)
for i in {1..60}; do for i in {1..60}; do
if curl -fsS http://127.0.0.1:3000/healthz >/dev/null; then echo "agent is ready"; break; fi if curl -fsS "http://127.0.0.1:3000/healthz" >/dev/null; then echo "agent is ready on 3000"; break; fi
sleep 1 sleep 1
done done
if ! curl -fsS http://127.0.0.1:3000/healthz >/dev/null; then if ! curl -fsS "http://127.0.0.1:3000/healthz" >/dev/null; then
echo "--- agent.log (tail) ---" echo "--- agent.log (tail) ---"; tail -n 200 agent.log || true; exit 1
tail -n 200 agent.log || true
echo "--- lsof/netstat ---"
(command -v ss >/dev/null && ss -ltnp || netstat -ltnp) || true
exit 1
fi fi
- name: Run WS probe test (Ubuntu) - name: Run WS probe test (Ubuntu)
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
shell: bash shell: bash
env:
SOCKTOP_WS: ws://127.0.0.1:3000/ws
run: | run: |
set -euo pipefail set -euo pipefail
# quick preflight
curl -fsS "http://127.0.0.1:${SOCKTOP_PORT}/healthz" >/dev/null
cargo test -p socktop --test ws_probe -- --nocapture cargo test -p socktop --test ws_probe -- --nocapture
- name: Stop agent (Ubuntu) - name: Stop agent (Ubuntu)
if: always() && matrix.os == 'ubuntu-latest' if: always() && matrix.os == 'ubuntu-latest'
@ -63,13 +61,17 @@ jobs:
shell: pwsh shell: pwsh
run: | run: |
# Start the already-built release binary to avoid rebuild delays # Start the already-built release binary to avoid rebuild delays
# Force TLS off for this probe # Force TLS off for this probe and disable slow/fragile sensors
$env:SOCKTOP_ENABLE_SSL = "0" $env:SOCKTOP_ENABLE_SSL = "0"
$env:SOCKTOP_AGENT_GPU = "0"
$env:SOCKTOP_AGENT_TEMP = "0"
$out = Join-Path $PWD "agent.out.txt" $out = Join-Path $PWD "agent.out.txt"
$err = Join-Path $PWD "agent.err.txt" $err = Join-Path $PWD "agent.err.txt"
$p = Start-Process -FilePath "${PWD}\\target\\release\\socktop_agent.exe" -ArgumentList "-p 3000" -RedirectStandardOutput $out -RedirectStandardError $err -PassThru -NoNewWindow $p = Start-Process -FilePath "${PWD}\target\release\socktop_agent.exe" -ArgumentList "-p 3000" -RedirectStandardOutput $out -RedirectStandardError $err -PassThru -NoNewWindow
echo "AGENT_PID=$($p.Id)" | Out-File -FilePath $env:GITHUB_ENV -Append echo "AGENT_PID=$($p.Id)" | Out-File -FilePath $env:GITHUB_ENV -Append
$ready = $false $ready = $false
echo "SOCKTOP_PORT=3000" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "SOCKTOP_WS=ws://127.0.0.1:3000/ws" | Out-File -FilePath $env:GITHUB_ENV -Append
for ($i = 0; $i -lt 60; $i++) { for ($i = 0; $i -lt 60; $i++) {
try { try {
$resp = Invoke-WebRequest -UseBasicParsing -Uri "http://127.0.0.1:3000/healthz" -TimeoutSec 2 -ErrorAction Stop $resp = Invoke-WebRequest -UseBasicParsing -Uri "http://127.0.0.1:3000/healthz" -TimeoutSec 2 -ErrorAction Stop
@ -90,6 +92,14 @@ jobs:
shell: pwsh shell: pwsh
run: | run: |
$env:SOCKTOP_WS = "ws://127.0.0.1:3000/ws" $env:SOCKTOP_WS = "ws://127.0.0.1:3000/ws"
# preflight
try {
$resp = Invoke-WebRequest -UseBasicParsing -Uri "http://127.0.0.1:3000/healthz" -TimeoutSec 5 -ErrorAction Stop
} catch {
Write-Host "--- agent.out (tail) ---"; if (Test-Path agent.out.txt) { Get-Content agent.out.txt -Tail 200 }
Write-Host "--- agent.err (tail) ---"; if (Test-Path agent.err.txt) { Get-Content agent.err.txt -Tail 200 }
throw "agent not healthy before test"
}
cargo test -p socktop --test ws_probe -- --nocapture cargo test -p socktop --test ws_probe -- --nocapture
- name: Stop agent (Windows) - name: Stop agent (Windows)
if: always() && matrix.os == 'windows-latest' if: always() && matrix.os == 'windows-latest'