[ARCH] Tier0/1 service health smoke tests: 3 pass
This commit is contained in:
1 parent
17eb75ff1a
commit
63d09982f3
1 file changed
+45
@@ -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)
|
||||
Reference in new issue
Block a user