Files
ProxMenux/AppImage/scripts/tests/test_idle_bridge.py
T
MacRimi 9b5cefb81a feat(oci): GPU selection per host and per image, one notification per update, and App tab for stack containers
- Immich asks what runs its video and its recognition in one menu, in both
  modes, and gives the GPU to the server and to Machine learning; AMD uses ROCm
- Frigate, Ollama, llama.cpp, Faster Whisper and Piper take the image built
  for the chosen GPU
- The acceleration menu offers only what the host can run
- An update or a recreation sends one notification with its result instead of
  the stop, backup and start of each container
- A private bridge with nothing connected is not reported as down
- Secondary containers of a stack appear in the App tab with their version and
  logo; Secure Gateway shows the same update state in both views
- A mistyped value in the wizard asks the same question again
2026-10-02 21:45:38 +02:00

40 lines
1.3 KiB
Python

"""A bridge with no port attached has no carrier and is not a failure: the
private network of an application whose containers are stopped."""
import sys
import tempfile
from pathlib import Path
import unittest
SCRIPTS = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(SCRIPTS))
from health_monitor import HealthMonitor
class IdleBridgeTests(unittest.TestCase):
def bridge(self, flags, ports=()):
tmp = tempfile.TemporaryDirectory()
self.addCleanup(tmp.cleanup)
folder = Path(tmp.name) / 'vmbr10'
(folder / 'brif').mkdir(parents=True)
(folder / 'flags').write_text(flags + '\n')
for port in ports:
(folder / 'brif' / port).mkdir()
return HealthMonitor._bridge_is_idle('vmbr10', tmp.name)
def test_an_up_bridge_with_no_port_is_idle(self):
self.assertTrue(self.bridge('0x1003'))
def test_a_bridge_with_ports_and_no_carrier_is_not_idle(self):
self.assertFalse(self.bridge('0x1003', ['enp3s0']))
self.assertFalse(self.bridge('0x1003', ['veth115i1']))
def test_a_bridge_set_down_is_not_idle(self):
self.assertFalse(self.bridge('0x1002'))
def test_an_interface_that_is_not_a_bridge_is_not_idle(self):
self.assertFalse(HealthMonitor._bridge_is_idle('vmbr10', '/nonexistent'))
if __name__ == '__main__':
unittest.main()