test(ssh-gate): assert SSHGate.stop is no-op on missing sidecar
PRD 0007: the launch ExitStack calls gate.stop on every failure path, so an early bring-up error (where the gate container was never created) must not raise from teardown. Mirrors the existing DockerPipelockProxy.stop assertion. The orphan-container enumeration in cleanup.py already covers ssh-gate containers via its `claude-bottle-` name prefix filter — no code change there.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
"""Integration: the cleanup primitives the start-flow trap depends on
|
||||
are idempotent. The original orphan-network bug was a trap-ordering
|
||||
issue; the fix moved the install earlier. The trap is only safe if
|
||||
network_remove and PipelockProxy.stop are no-ops against missing
|
||||
resources."""
|
||||
network_remove, PipelockProxy.stop, and SSHGate.stop are no-ops
|
||||
against missing resources."""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
@@ -17,6 +17,10 @@ from claude_bottle.backend.docker.pipelock import (
|
||||
DockerPipelockProxy,
|
||||
pipelock_container_name,
|
||||
)
|
||||
from claude_bottle.backend.docker.ssh_gate import (
|
||||
DockerSSHGate,
|
||||
ssh_gate_container_name,
|
||||
)
|
||||
from tests._docker import skip_unless_docker
|
||||
|
||||
|
||||
@@ -75,6 +79,13 @@ class TestOrphanCleanup(unittest.TestCase):
|
||||
# Should not raise.
|
||||
DockerPipelockProxy().stop(pipelock_container_name(f"missing-{self.slug}"))
|
||||
|
||||
def test_ssh_gate_stop_missing_sidecar(self):
|
||||
# Same trap-safety requirement for the gate (PRD 0007). The
|
||||
# launch ExitStack calls gate.stop on every error path; if
|
||||
# the container was never created (early failure), stop must
|
||||
# still no-op.
|
||||
DockerSSHGate().stop(ssh_gate_container_name(f"missing-{self.slug}"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user