Files
StarPilot/openpilot/starpilot/galaxy/tests/test_local_network_address.py
T
firestar5683 80fbb4f6db Feature registration
Register vehicle controls, planner modes, UI actions and Galaxy services after their providers exist. Wire the shared runtime entrypoints and cover their combined behavior.

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Daniel Koepping <elkoled@gmail.com>
Co-authored-by: Danny <dannyirwin31@yahoo.com>
Co-authored-by: DimitriChrysafis <Dimitri.chrysafis@gmail.com>
Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com>
Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com>
Co-authored-by: Kacper Rączy <gfw.kra@gmail.com>
Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu>
Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com>
Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>
Co-authored-by: stef <19478336+stefpi@users.noreply.github.com>
Co-authored-by: whoisdomi <dcantu83@gmail.com>

Co-authored-by: Intelli <contact@intelli.software>
Co-authored-by: haraschax <6804392+haraschax@users.noreply.github.com>
Co-authored-by: prabhaavp <prabhaav@msu.edu>
2026-10-14 20:02:39 -05:00

24 lines
1.1 KiB
Python

import json
from types import SimpleNamespace
from openpilot.starpilot.galaxy.local_access import LocalAccess
def test_network_changes_expire_and_virtual_addresses_never_appear():
def iface(name, ip, **extra):
return dict(ifname=name, flags=['UP'], addr_info=[{'family': 'inet', 'scope': 'global', 'local': ip}], **extra)
now = [0.0]
inventory = [iface('wlan0', '192.168.3.110'), iface('tun0', '10.0.0.1'),
iface('customVPN', '10.1.0.1', linkinfo={'info_kind': 'wireguard'}),
iface('ppp0', '10.208.34.39'), iface('p2p-wlan0', '192.168.49.1'), iface('eth0', '10.2.3.4', operstate='DOWN')]
def run(*args, **kwargs):
return SimpleNamespace(stdout=json.dumps(inventory).encode())
reader = LocalAccess(run=run, clock=lambda: now[0])
assert [r['interface'] for r in reader.snapshot()['addresses']] == ['wlan0']
inventory.clear()
now[0] = 5.1
assert reader.snapshot()['addresses'] == []
inventory.append(iface('wlan0', '192.168.1.50'))
now[0] = 10.2
assert reader.snapshot()['addresses'][0]['url'] == 'http://192.168.1.50:8082/'