from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]


def test_active_monitoring_prometheus_scrapes_momo_app_metrics():
    config = (ROOT / "monitoring/prometheus.yml").read_text(encoding="utf-8")

    assert "job_name: 'momo-app'" in config
    assert "metrics_path: /metrics" in config
    assert "targets: ['momo-pro-system:80']" in config


def test_monitoring_stack_connects_prometheus_to_momo_network():
    compose = (ROOT / "monitoring/docker-compose.yml").read_text(encoding="utf-8")

    assert "momo-network:" in compose
    assert "external: true" in compose
    assert "name: momo-network" in compose


def test_compose_prometheus_uses_container_dns_for_momo_app():
    config = (ROOT / "docker/prometheus/prometheus.yml").read_text(encoding="utf-8")

    assert "job_name: 'momo-app'" in config
    assert "targets: ['momo-pro-system:80']" in config
