From 5f10e34341360b18512902db58bc0f3f73c30d14 Mon Sep 17 00:00:00 2001 From: jasonwitty Date: Wed, 20 Aug 2025 15:20:07 -0700 Subject: [PATCH] windows try/fix --- .github/workflows/ci.yml | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2644b9..eff456d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,29 +29,27 @@ jobs: run: | set -euo pipefail # Start the already-built release binary to avoid rebuild delays - # Force TLS off for this probe - RUST_LOG=info SOCKTOP_ENABLE_SSL=0 ./target/release/socktop_agent -p 3000 > agent.log 2>&1 & + # Force TLS off for this probe and disable slow/fragile sensors + 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=$! 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) 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 done - if ! curl -fsS http://127.0.0.1:3000/healthz >/dev/null; then - echo "--- agent.log (tail) ---" - tail -n 200 agent.log || true - echo "--- lsof/netstat ---" - (command -v ss >/dev/null && ss -ltnp || netstat -ltnp) || true - exit 1 + if ! curl -fsS "http://127.0.0.1:3000/healthz" >/dev/null; then + echo "--- agent.log (tail) ---"; tail -n 200 agent.log || true; exit 1 fi - name: Run WS probe test (Ubuntu) if: matrix.os == 'ubuntu-latest' shell: bash - env: - SOCKTOP_WS: ws://127.0.0.1:3000/ws run: | 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 - name: Stop agent (Ubuntu) if: always() && matrix.os == 'ubuntu-latest' @@ -63,13 +61,17 @@ jobs: shell: pwsh run: | # 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_AGENT_GPU = "0" + $env:SOCKTOP_AGENT_TEMP = "0" $out = Join-Path $PWD "agent.out.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 $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++) { try { $resp = Invoke-WebRequest -UseBasicParsing -Uri "http://127.0.0.1:3000/healthz" -TimeoutSec 2 -ErrorAction Stop @@ -90,6 +92,14 @@ jobs: shell: pwsh run: | $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 - name: Stop agent (Windows) if: always() && matrix.os == 'windows-latest'