test(dry-run): pin DOCKER_HOST so HOME override works on Desktop
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:
@@ -34,6 +34,20 @@ class TestDryRunPlan(unittest.TestCase):
|
|||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env["HOME"] = str(work_dir)
|
env["HOME"] = str(work_dir)
|
||||||
env.pop("CLAUDE_BOTTLE_DRY_RUN", None)
|
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(
|
result = subprocess.run(
|
||||||
[
|
[
|
||||||
sys.executable, str(REPO_ROOT / "cli.py"),
|
sys.executable, str(REPO_ROOT / "cli.py"),
|
||||||
|
|||||||
Reference in New Issue
Block a user