Listen for dbus property changes (#3872)

* Listen for dbus property changes

* Avoid remaking dbus proxy objects

* proper snake case for pylint

* some cleanup and more tests
This commit is contained in:
Mike Degatano
2022-09-17 03:55:41 -04:00
committed by GitHub
parent 0b09eb3659
commit 99bc201688
54 changed files with 1207 additions and 444 deletions

View File

@@ -1,4 +1,5 @@
"""Test Datadisk/Agent dbus interface."""
import asyncio
from pathlib import Path
import pytest
@@ -6,6 +7,8 @@ import pytest
from supervisor.coresys import CoreSys
from supervisor.exceptions import DBusNotConnectedError
from tests.common import fire_property_change_signal
async def test_dbus_osagent_datadisk(coresys: CoreSys):
"""Test coresys dbus connection."""
@@ -16,6 +19,16 @@ async def test_dbus_osagent_datadisk(coresys: CoreSys):
assert coresys.dbus.agent.datadisk.current_device.as_posix() == "/dev/sda"
fire_property_change_signal(
coresys.dbus.agent.datadisk, {"CurrentDevice": "/dev/sda1"}
)
await asyncio.sleep(0)
assert coresys.dbus.agent.datadisk.current_device.as_posix() == "/dev/sda1"
fire_property_change_signal(coresys.dbus.agent.datadisk, {}, ["CurrentDevice"])
await asyncio.sleep(0)
assert coresys.dbus.agent.datadisk.current_device.as_posix() == "/dev/sda"
async def test_dbus_osagent_datadisk_change_device(coresys: CoreSys, dbus: list[str]):
"""Change datadisk on device."""