feat: hand the container engine connection Container Station's docker
CI / test (3.11) (pull_request) Successful in 27s
CI / test (3.12) (pull_request) Successful in 30s
CI / test (3.10) (push) Successful in 29s
CI / test (3.11) (push) Successful in 27s
CI / test (3.12) (push) Successful in 28s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.11) (pull_request) Successful in 27s
CI / test (3.12) (pull_request) Successful in 30s
CI / test (3.10) (push) Successful in 29s
CI / test (3.11) (push) Successful in 27s
CI / test (3.12) (push) Successful in 28s
CI / test (3.10) (pull_request) Successful in 29s
napalm-device-types 2.6.0 opens a host's container engine through `open_container_engine()`, and asks the driver for the binary through `_container_engine_binary()`. Under QTS docker is not on PATH; the hook now returns the path `open()` already discovers, so the Engine API stream (`<path> system dial-stdio`) and the CLI reach Container Station while callers only pass arguments (NetOrk/netork#765). Version 0.2.0, requires napalm-device-types >= 2.6.0 and napalm-linux >= 0.2.0. Refs NAPALM/napalm-device-types#17
This commit is contained in:
@@ -184,6 +184,27 @@ class TestDockerBinDiscovery:
|
||||
assert driver._docker_bin() == "/opt/docker"
|
||||
|
||||
|
||||
class TestContainerEngineBinary:
|
||||
"""The container engine connection (napalm-device-types 2.6.0) reaches
|
||||
Container Station's docker, not one on PATH: the driver decides where the
|
||||
binary lives, and netOrk never sees it (NetOrk/netork#765)."""
|
||||
|
||||
def test_the_engine_binary_is_the_discovered_path(self, driver):
|
||||
driver._docker_path = "/share/CACHEDEV1_DATA/.qpkg/container-station/bin/docker"
|
||||
assert driver._container_engine_binary("docker") == driver._docker_path
|
||||
|
||||
def test_the_api_stream_runs_dial_stdio_from_that_path(self, driver):
|
||||
driver._docker_path = "/share/CACHEDEV1_DATA/.qpkg/container-station/bin/docker"
|
||||
opened = []
|
||||
with patch.object(driver, "open_stream", side_effect=lambda cmd, **kw: opened.append(cmd)):
|
||||
driver.open_container_engine("docker").open_api()
|
||||
assert opened == [f"{driver._docker_path} system dial-stdio"]
|
||||
|
||||
def test_without_a_discovered_path_it_falls_back_to_plain_docker(self, driver):
|
||||
driver._docker_path = None
|
||||
assert driver._container_engine_binary("docker") == "docker"
|
||||
|
||||
|
||||
def test_services_cannot_be_controlled():
|
||||
"""QTS has no systemd: the systemctl actions inherited from LinuxDriver would
|
||||
fail on every unit, so the driver says it cannot control services at all --
|
||||
|
||||
Reference in New Issue
Block a user