Checks node-local prerequisites that break Hermes after relocation: direct TLS egress to api.telegram.org and real NFS read/write against the Hermes agent export. Removes the tester self-probe that caused every round to crash. Tests: compileall, unittest, git diff --check. Reviewed-on: #50 Co-authored-by: Alex Rudenk <rudolfss13+hermes@gmail.com>
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
import unittest
|
|
|
|
from host_checks import build_host_checks, parse_peers
|
|
|
|
|
|
class HostChecksTests(unittest.TestCase):
|
|
def test_parse_peers(self):
|
|
self.assertEqual(
|
|
parse_peers("odroid=192.168.1.96,rudolf-T=100.105.201.15"),
|
|
[("odroid", "192.168.1.96"), ("rudolf-T", "100.105.201.15")],
|
|
)
|
|
|
|
def test_parse_peers_ignores_invalid_entries(self):
|
|
self.assertEqual(
|
|
parse_peers("odroid=192.168.1.96,broken,rudolf-T="),
|
|
[("odroid", "192.168.1.96")],
|
|
)
|
|
|
|
def test_build_host_checks(self):
|
|
checks = build_host_checks(
|
|
[("odroid", "192.168.1.96"), ("rudolf-T", "100.105.201.15")],
|
|
[2377, 7946],
|
|
[7946, 4789],
|
|
)
|
|
self.assertEqual(
|
|
checks,
|
|
[
|
|
("odroid", "192.168.1.96", "tcp", 2377),
|
|
("odroid", "192.168.1.96", "tcp", 7946),
|
|
("odroid", "192.168.1.96", "udp", 7946),
|
|
("odroid", "192.168.1.96", "udp", 4789),
|
|
("rudolf-T", "100.105.201.15", "tcp", 2377),
|
|
("rudolf-T", "100.105.201.15", "tcp", 7946),
|
|
("rudolf-T", "100.105.201.15", "udp", 7946),
|
|
("rudolf-T", "100.105.201.15", "udp", 4789),
|
|
],
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|