feat: enhance service discovery and proxy management
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
from pathlib import Path
|
||||
|
||||
from integrations.docker.compose import get_all_services_in_dir
|
||||
|
||||
|
||||
def test_get_all_services_in_dir_scans_immediate_children(tmp_path: Path):
|
||||
root = tmp_path / "workspace"
|
||||
project = root / "playground"
|
||||
project.mkdir(parents=True)
|
||||
(project / "docker-compose.yml").write_text(
|
||||
"""
|
||||
services:
|
||||
echo:
|
||||
image: hashicorp/http-echo:1.0
|
||||
ports:
|
||||
- "9081:5678"
|
||||
""".strip(),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
services = get_all_services_in_dir(root)
|
||||
|
||||
assert services == [
|
||||
{
|
||||
"name": "echo",
|
||||
"ports": [9081],
|
||||
"bindings": [{"published": 9081, "host": None}],
|
||||
"folder": project,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def test_get_all_services_in_dir_skips_nested_grandchildren(tmp_path: Path):
|
||||
root = tmp_path / "workspace"
|
||||
nested = root / "group" / "playground"
|
||||
nested.mkdir(parents=True)
|
||||
(nested / "docker-compose.yml").write_text(
|
||||
"""
|
||||
services:
|
||||
echo:
|
||||
image: hashicorp/http-echo:1.0
|
||||
ports:
|
||||
- "9081:5678"
|
||||
""".strip(),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
services = get_all_services_in_dir(root)
|
||||
|
||||
assert services == []
|
||||
Reference in New Issue
Block a user