From 63d09982f34a5b8d07d891513571a62db2cc45c8 Mon Sep 17 00:00:00 2001 From: architect Date: Thu, 26 Nov 2026 22:00:44 +0300 Subject: [PATCH] [ARCH] Tier0/1 service health smoke tests: 3 pass --- ops/audit/tests/test_service_health.py | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 ops/audit/tests/test_service_health.py diff --git a/ops/audit/tests/test_service_health.py b/ops/audit/tests/test_service_health.py new file mode 100644 index 0000000..91b2912 --- /dev/null +++ b/ops/audit/tests/test_service_health.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +"""Read-only health smoke for Tier0/1 service cards.""" +import socket +import unittest +import urllib.error +import urllib.request + +CHECKS = { + "audit": "http://127.0.0.1:9160/health", + "gitea": "http://192.168.1.140:3000/api/v1/version", + "authentik": "http://192.168.1.114:9000/-/health/live/", + "matrix": "http://192.168.1.155:8008/_matrix/client/versions", + "prism": "http://127.0.0.1:8095/api/health", + "seerr": "http://192.168.1.121:5055/api/v1/status", +} + + +def http_ok(url): + try: + with urllib.request.urlopen(url, timeout=6) as r: + return 200 <= r.status < 400 + except Exception: + return False + + +class ServiceHealth(unittest.TestCase): + def test_http_cards(self): + failures = {name: url for name, url in CHECKS.items() if not http_ok(url)} + self.assertEqual(failures, {}) + + def test_postgres_tcp(self): + s = socket.socket() + s.settimeout(3) + s.connect(("192.168.1.151", 5432)) + s.close() + + def test_nats_tcp(self): + s = socket.socket() + s.settimeout(3) + s.connect(("192.168.1.115", 4222)) + s.close() + + +if __name__ == "__main__": + unittest.main(verbosity=2)