mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-09 10:59:43 +00:00
Set bind propagation mode for media (#4308)
* Set bind propagation mode for media * Add some test cases
This commit is contained in:
38
tests/docker/test_dns.py
Normal file
38
tests/docker/test_dns.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Test DNS plugin container."""
|
||||
|
||||
from ipaddress import IPv4Address
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
from docker.types import Mount
|
||||
|
||||
from supervisor.coresys import CoreSys
|
||||
from supervisor.docker.manager import DockerAPI
|
||||
|
||||
|
||||
async def test_start(coresys: CoreSys, tmp_supervisor_data: Path, path_extern):
|
||||
"""Test starting dns plugin."""
|
||||
config_file = tmp_supervisor_data / "dns" / "coredns.json"
|
||||
assert not config_file.exists()
|
||||
|
||||
with patch.object(DockerAPI, "run") as run:
|
||||
await coresys.plugins.dns.start()
|
||||
|
||||
run.assert_called_once()
|
||||
assert run.call_args.kwargs["ipv4"] == IPv4Address("172.30.32.3")
|
||||
assert run.call_args.kwargs["name"] == "hassio_dns"
|
||||
assert run.call_args.kwargs["hostname"] == "hassio-dns"
|
||||
assert run.call_args.kwargs["dns"] is False
|
||||
assert run.call_args.kwargs["oom_score_adj"] == -300
|
||||
assert run.call_args.kwargs["mounts"] == [
|
||||
Mount(
|
||||
type="bind",
|
||||
source=coresys.config.path_extern_dns.as_posix(),
|
||||
target="/config",
|
||||
read_only=False,
|
||||
),
|
||||
Mount(type="bind", source="/run/dbus", target="/run/dbus", read_only=True),
|
||||
]
|
||||
assert "volumes" not in run.call_args.kwargs
|
||||
|
||||
assert config_file.exists()
|
||||
Reference in New Issue
Block a user