mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-24 20:35:55 +00:00
Map both persistent and volatile journald logs (#2765)
* Map both persistent and volatile journald logs * Code comment tweak
This commit is contained in:
@@ -97,36 +97,23 @@ def test_addon_map_folder_defaults(
|
||||
assert str(docker_addon.sys_config.path_extern_share) not in volumes
|
||||
|
||||
|
||||
def test_journald_addon_volatile(coresys: CoreSys, addonsdata_system: Dict[str, Data]):
|
||||
"""Validate volume for journald option, with volatile logs."""
|
||||
with patch("pathlib.Path.exists", return_value=False):
|
||||
docker_addon = get_docker_addon(
|
||||
coresys, addonsdata_system, "journald-addon-config.json"
|
||||
)
|
||||
volumes = docker_addon.volumes
|
||||
|
||||
assert str(SYSTEMD_JOURNAL_VOLATILE) in volumes
|
||||
assert volumes.get(str(SYSTEMD_JOURNAL_VOLATILE)).get("bind") == str(
|
||||
SYSTEMD_JOURNAL_PERSISTENT
|
||||
def test_journald_addon(coresys: CoreSys, addonsdata_system: Dict[str, Data]):
|
||||
"""Validate volume for journald option."""
|
||||
docker_addon = get_docker_addon(
|
||||
coresys, addonsdata_system, "journald-addon-config.json"
|
||||
)
|
||||
assert volumes.get(str(SYSTEMD_JOURNAL_VOLATILE)).get("mode") == "ro"
|
||||
|
||||
|
||||
def test_journald_addon_persistent(
|
||||
coresys: CoreSys, addonsdata_system: Dict[str, Data]
|
||||
):
|
||||
"""Validate volume for journald option, with persistent logs."""
|
||||
with patch("pathlib.Path.exists", return_value=True):
|
||||
docker_addon = get_docker_addon(
|
||||
coresys, addonsdata_system, "journald-addon-config.json"
|
||||
)
|
||||
volumes = docker_addon.volumes
|
||||
volumes = docker_addon.volumes
|
||||
|
||||
assert str(SYSTEMD_JOURNAL_PERSISTENT) in volumes
|
||||
assert volumes.get(str(SYSTEMD_JOURNAL_PERSISTENT)).get("bind") == str(
|
||||
SYSTEMD_JOURNAL_PERSISTENT
|
||||
)
|
||||
assert volumes.get(str(SYSTEMD_JOURNAL_PERSISTENT)).get("mode") == "ro"
|
||||
assert str(SYSTEMD_JOURNAL_VOLATILE) in volumes
|
||||
assert volumes.get(str(SYSTEMD_JOURNAL_VOLATILE)).get("bind") == str(
|
||||
SYSTEMD_JOURNAL_VOLATILE
|
||||
)
|
||||
assert volumes.get(str(SYSTEMD_JOURNAL_VOLATILE)).get("mode") == "ro"
|
||||
|
||||
|
||||
def test_not_journald_addon(coresys: CoreSys, addonsdata_system: Dict[str, Data]):
|
||||
|
||||
Reference in New Issue
Block a user