From 1d8449515e4e11038160337c4b650f125615e813 Mon Sep 17 00:00:00 2001 From: max Date: Fri, 25 Sep 2026 23:08:29 +0200 Subject: [PATCH] fix(ci): use public /health probe and authorize Hermes report requests in pipeline test --- .gitea/workflows/ci.yml | 4 ++-- tests/test_pipeline.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 56587ca..b02ff69 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -49,10 +49,10 @@ jobs: SERVER_PID=$! echo "[*] Server launched in background with PID $SERVER_PID" - # 3. Poll Hermes health / report endpoint until server is listening + # 3. Poll /health endpoint until server is listening READY=0 for i in $(seq 1 20); do - if python3 -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8443/api/hermes/report', timeout=1)" >/dev/null 2>&1; then + if python3 -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8443/health', timeout=1)" >/dev/null 2>&1; then echo "[+] LOGAR Server is ready after ${i}s." READY=1 break diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index 4c9c3e6..11a532d 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -147,7 +147,7 @@ def run_tests(): return json.loads(resp_bytes.decode("utf-8")) print("\n=== [3] Testing Temporal Persistence & Direct Anomaly Verification over mTLS ===") - test_signature = "TestServiceDegraded" + test_signature = f"TestServiceDegraded_{int(time.time())}" candidate_log = [{ "server": client_id, "os_type": "linux", @@ -181,7 +181,7 @@ def run_tests(): print("[OK] Direct verification confirmed: Warning immediately verified for Hermes with run count tracking over mTLS!") print("\n=== [4] Testing Immediate Pass for Errors over mTLS ===") - error_signature = "TestServiceCrashImmediate" + error_signature = f"TestServiceCrashImmediate_{int(time.time())}" error_log = [{ "server": client_id, "os_type": "linux", @@ -207,7 +207,9 @@ def run_tests(): print("[OK] Immediate pass verified: Error promoted to VERIFIED anomaly immediately!") print("\n=== [5] Testing Hermes Reporting Endpoint (/api/hermes/report) ===") - req = urllib.request.Request(f"http://{HERMES_HOST}:{HERMES_PORT}/api/hermes/report") + token = server_conf.get("auth_token") or client_conf.get("auth_token") + headers = {"Authorization": f"Bearer {token}"} if token else {} + req = urllib.request.Request(f"http://{HERMES_HOST}:{HERMES_PORT}/api/hermes/report", headers=headers) with urllib.request.urlopen(req, timeout=5) as response: assert response.status == 200, f"Expected 200, got {response.status}" hermes_data = json.loads(response.read().decode("utf-8"))