fix: docsgpt up --adopt recreates every container

Compose keeps containers whose configuration did not change, so after a
takeover Redis and Postgres still carried the other folder's working
directory label, and the next `docsgpt up` asked for --adopt again.
This commit is contained in:
Alex committed 2026-09-15 23:11:32 +01:00
1 parent 0bd0afc1f8
commit c7af5f873a
2 files changed
+22 -6

No files matched your search

+11
View File
@@ -185,6 +185,17 @@ class TestUpAgain:
assert docker.calls == []
assert _run(["up", "--yes", "--adopt", "--dir", str(tmp_path)], _context(docker)) == 0
def test_adopting_recreates_every_container(self, tmp_path):
"""Compose keeps unchanged containers, and with them the old folder's label; the next up would ask again."""
docker = FakeDocker(project_dirs={"/srv/old-docsgpt"})
assert _run(["up", "--yes", "--adopt", "--dir", str(tmp_path)], _context(docker)) == 0
assert docker.calls == [(tmp_path, ["up", "-d", "--remove-orphans", "--force-recreate"])]
def test_containers_from_this_folder_are_not_recreated(self, tmp_path):
docker = FakeDocker(project_dirs={str(tmp_path)})
assert _run(["up", "--yes", "--dir", str(tmp_path)], _context(docker)) == 0
assert docker.calls == [(tmp_path, ["up", "-d", "--remove-orphans"])]
def test_consent_can_be_given_at_the_prompt(self, tmp_path):
docker = FakeDocker(project_dirs={"/srv/old-docsgpt"})
prompter = FakePrompter([True, "local", "docsgpt"])