test(dry-run): pin DOCKER_HOST so HOME override works on Desktop
test / unit (push) Successful in 14s
test / integration (push) Failing after 15s

The test overrides HOME to isolate the manifest under test from the
dev's real ~/claude-bottle.json. On Docker Desktop that override
also breaks docker CLI endpoint resolution, since the active context
is read from $HOME/.docker/config.json and the per-user socket lives
under $HOME/.docker/run/docker.sock. Forward the parent's resolved
endpoint via DOCKER_HOST so the subprocess reaches the same daemon
regardless of $HOME.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-12 10:40:41 -04:00
parent 5f29fd10e2
commit 3e7b81e7e7
+14
View File
@@ -34,6 +34,20 @@ class TestDryRunPlan(unittest.TestCase):
env = os.environ.copy()
env["HOME"] = str(work_dir)
env.pop("CLAUDE_BOTTLE_DRY_RUN", None)
# The HOME override above isolates the manifest under test
# from the dev's real ~/claude-bottle.json. On Docker Desktop
# that same override breaks docker CLI endpoint resolution,
# since the active context lives in $HOME/.docker/config.json
# and the per-user socket sits under $HOME/.docker/run/.
# Pin DOCKER_HOST to the parent's resolved endpoint so the
# subprocess reaches the same daemon regardless of $HOME.
endpoint = subprocess.run(
["docker", "context", "inspect",
"--format", "{{.Endpoints.docker.Host}}"],
capture_output=True, text=True, check=True,
).stdout.strip()
if endpoint:
env["DOCKER_HOST"] = endpoint
result = subprocess.run(
[
sys.executable, str(REPO_ROOT / "cli.py"),