refactor!: drop the Docker CLI methods
CI / test (3.10) (push) Successful in 41s
CI / test (3.11) (push) Successful in 37s
CI / test (3.12) (push) Successful in 38s
CI / test (3.10) (pull_request) Successful in 37s
CI / test (3.11) (pull_request) Successful in 36s
CI / test (3.12) (pull_request) Successful in 38s
CI / test (3.10) (push) Successful in 41s
CI / test (3.11) (push) Successful in 37s
CI / test (3.12) (push) Successful in 38s
CI / test (3.10) (pull_request) Successful in 37s
CI / test (3.11) (pull_request) Successful in 36s
CI / test (3.12) (pull_request) Successful in 38s
get_docker_info(), get_docker_outdated(), reconstruct_docker_run() and the _docker_bin() hook go, with the image-ID helpers. netOrk reads and handles containers over the Engine API through open_container_engine() since NetOrk/netork#765 and no longer calls them (phase 9). The fix_docker_permissions action stays: it is an OS action. Version 0.3.0.
This commit is contained in:
+10
-52
@@ -866,60 +866,18 @@ class TestRunDeviceActionDispatch:
|
||||
mock_action.assert_called_once()
|
||||
|
||||
|
||||
class TestDockerBinHook:
|
||||
"""Where the docker binary lives is device-specific; what to do with it is not.
|
||||
class TestNoDockerOfItsOwn:
|
||||
"""Containers are read and handled by netOrk over the Engine API, through
|
||||
``open_container_engine`` (NetOrk/netork#765). The old CLI methods are gone;
|
||||
only the OS action that lets the login user use Docker stays."""
|
||||
|
||||
QTS puts Container Station's docker under /share/<pool>/.qpkg/ and not on
|
||||
PATH. Rather than duplicating the whole Docker surface in the QNAP driver,
|
||||
the path is a one-method hook here and the logic stays generic. See
|
||||
docs/ARCHITECTURE.md §4.4, "Generisch vs. treiberspezifisch".
|
||||
"""
|
||||
def test_the_cli_methods_are_gone(self):
|
||||
for name in ("get_docker_info", "get_docker_outdated", "reconstruct_docker_run", "_docker_bin"):
|
||||
assert not hasattr(LinuxDriver, name), name
|
||||
|
||||
def test_defaults_to_docker_on_path(self, driver):
|
||||
assert driver._docker_bin() == "docker"
|
||||
|
||||
def test_detection_uses_the_hook(self, driver):
|
||||
"""A subclass pointing elsewhere must not be probed for a PATH docker."""
|
||||
sent = []
|
||||
|
||||
def _record(cmd, **kwargs):
|
||||
sent.append(cmd)
|
||||
return ""
|
||||
|
||||
with patch.object(driver, "_docker_bin", return_value="/opt/cs/docker"):
|
||||
with patch.object(driver, "_send", side_effect=_record):
|
||||
result = driver.get_docker_info()
|
||||
|
||||
assert result == {"available": False}
|
||||
assert any("/opt/cs/docker" in cmd for cmd in sent)
|
||||
assert not any("command -v docker " in cmd for cmd in sent)
|
||||
|
||||
def test_all_docker_subcommands_use_the_hook(self, driver):
|
||||
"""Half-converted call sites are the failure mode here: detection would
|
||||
find the binary and the actual queries would still miss it."""
|
||||
sent = []
|
||||
|
||||
def _record(cmd, **kwargs):
|
||||
sent.append(cmd)
|
||||
if "command -v" in cmd:
|
||||
return "/opt/cs/docker"
|
||||
if "---CONTAINERS---" in cmd:
|
||||
return "---CONTAINERS---\n---IMAGES---\n---VOLUMES---\n---NETWORKS---\n"
|
||||
return ""
|
||||
|
||||
with patch.object(driver, "_docker_bin", return_value="/opt/cs/docker"):
|
||||
with patch.object(driver, "_send", side_effect=_record):
|
||||
driver.get_docker_info()
|
||||
|
||||
docker_cmds = [c for c in sent if "docker" in c]
|
||||
assert docker_cmds
|
||||
for cmd in docker_cmds:
|
||||
assert "/opt/cs/docker" in cmd, f"unconverted call site: {cmd}"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# uninstall_package – purge, and getting out of `install ok unpacked`
|
||||
# ---------------------------------------------------------------------------
|
||||
def test_the_engine_access_and_the_permission_fix_stay(self):
|
||||
assert hasattr(LinuxDriver, "open_container_engine")
|
||||
assert hasattr(LinuxDriver, "_action_fix_docker_permissions")
|
||||
|
||||
|
||||
class TestUninstallPackage:
|
||||
|
||||
Reference in New Issue
Block a user