Refactor DockerComposeManager usage in basic_example and enhance error handling for service, network, config, and secret management

This commit is contained in:
2025-06-18 05:05:29 +02:00
parent c8e262a736
commit 2557aacd5d
3 changed files with 162 additions and 42 deletions

View File

@ -71,12 +71,8 @@ def test_modify_nonexistent_service(tmp_path: Path) -> None:
def test_remove_nonexistent_service(tmp_path: Path) -> None:
compose_file: Path = tmp_path / "docker-compose.yml"
manager = DockerComposeManager(str(compose_file))
# Should not raise
manager.remove_service("notfound").save()
with compose_file.open() as f:
data = yaml.safe_load(f)
assert "services" in data
assert data["services"] == {}
with pytest.raises(KeyError):
manager.remove_service("notfound")
def test_create_service_with_extra_kwargs(tmp_path: Path) -> None: