Say which machine is unreachable instead of FIX FAILED
The Bible TV PC's Wi-Fi dropped for ~30 s at 06:17 on 2026-10-11; the hold could not reach it and showed FIX FAILED, though nothing on the PC was broken. An ssh fix that cannot reach its machine now shows e.g. "BIBLE APP NOT REACHABLE". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -838,7 +838,8 @@ class TestFixes(unittest.TestCase):
|
||||
mock.patch.object(sp, "wake_on_lan", side_effect=lambda mac, bc=None: woke.append((mac, bc))):
|
||||
self.assertEqual(sp.execute_fix(CONFIG, "obs", {"conn": "OBS-Youtube"}), sp.WAKING)
|
||||
self.assertEqual(woke, [("6c:24:08:d7:fb:57", "10.1.255.255")])
|
||||
self.assertFalse(sp.execute_fix(CONFIG, "arena", {"conn": "arena"})) # no MAC: just fails
|
||||
self.assertEqual(sp.execute_fix(CONFIG, "arena", {"conn": "arena"}), # no MAC: says so
|
||||
"ARENA NOT\nREACHABLE")
|
||||
self.assertEqual(len(woke), 1)
|
||||
# the button says so
|
||||
self.snap.conns["OBS-Youtube"]["category"] = "error"
|
||||
@@ -848,6 +849,15 @@ class TestFixes(unittest.TestCase):
|
||||
time.sleep(0.2)
|
||||
self.assertEqual(self.engine.step(self.snap, time.time())["obs"]["x"], "OBS\nWAKING PC\nOBS")
|
||||
|
||||
def test_an_unreachable_pc_is_named_not_failed(self):
|
||||
from unittest import mock
|
||||
gone = mock.Mock(returncode=255, stdout="", stderr="ssh: connect to host 10.6.7.13 port 22: Operation timed out")
|
||||
with mock.patch.object(sp.subprocess, "run", return_value=gone):
|
||||
self.assertEqual(sp.execute_fix(CONFIG, "bibleapp", {}), "BIBLE APP NOT\nREACHABLE")
|
||||
refused = mock.Mock(returncode=1, stdout="", stderr="") # reached it, the command failed
|
||||
with mock.patch.object(sp.subprocess, "run", return_value=refused):
|
||||
self.assertFalse(sp.execute_fix(CONFIG, "bibleapp", {}))
|
||||
|
||||
def test_magic_packet(self):
|
||||
from unittest import mock
|
||||
with mock.patch.object(sp.socket, "socket") as sock:
|
||||
|
||||
Reference in New Issue
Block a user