read the config the module writes: containers can be turned off
The module rendered containers_enabled, workspace_base, container_mode, max_containers and the pointer lease keys into the TOML, and policy.py read only [defaults] and [apps] -- so the settings were inert. The defaults coincided, which made it look honoured, until a deployment tried to turn containers off and found it could not. Settings now come from the same file: parsed beside Policy (read by __main__, so the manager keeps taking a plain ManagerConfig its tests build directly) and carried into ContainerHost, which reports itself unavailable when switched off. That is the whole mechanism -- the manager already treats an unavailable host as 'sessions without containers', which is what turning them off means -- and the reason names the key, so a disabled machine cannot be mistaken for one whose compositor is down. This is what made the rollback on the host possible; the machine had containers built, tested, and impossible to disable.
This commit is contained in:
1 parent
c1dc60af00
commit
8f3f000783
6 files changed
+221
-1
No files matched your search
@@ -28,6 +28,26 @@ def compositor(short_tmpdir: Path):
|
||||
fake.stop()
|
||||
|
||||
|
||||
def test_a_disabled_host_is_unavailable_and_says_why() -> None:
|
||||
"""Turning containers off must be configuration, not a false compositor.
|
||||
|
||||
``available()`` is the whole mechanism: the manager already treats an
|
||||
unavailable host as "sessions without containers", which is exactly what
|
||||
turning them off means, so nothing else has to branch on it. It must also
|
||||
not ask a compositor this deployment never intended to talk to -- and its
|
||||
reason has to name the key, or a machine with containers disabled looks
|
||||
identical to one whose compositor is down and the operator goes hunting for a
|
||||
fault that is not there.
|
||||
"""
|
||||
|
||||
host = ContainerHost(
|
||||
None, allocator=containers.WorkspaceAllocator(1000, 4), enabled=False
|
||||
)
|
||||
|
||||
assert host.available() is False
|
||||
assert "containers_enabled" in (host.last_error or "")
|
||||
|
||||
|
||||
def make_host(fake: FakeCompositor, *, slots: int = 4) -> ContainerHost:
|
||||
return ContainerHost(
|
||||
fake.runtime_dir,
|
||||
|
||||
Reference in new issue
Block a user