- Зачем: - зелёный результат проверок должен означать фактический стык и точный контракт дашборда. - Что: - проверка startup-history читает manifest, требует live seam и непустой ODS. - добавлен быстрый runtime gate для daily-wave и live-продолжения. - Superset sync ограничен целевым dashboard и сверяет существенные params. - Проверка: - docker target tests; make generator-test; make generated-history-runtime-check.
73 lines
3.2 KiB
Python
73 lines
3.2 KiB
Python
from pathlib import Path
|
|
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def test_generated_history_check_uses_actual_manifest_boundary_and_profile():
|
|
"""Проверка берёт стык и профиль из manifest фактического прогона."""
|
|
script = (REPO_ROOT / "scripts" / "check_generated_analytics.sh").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
makefile = (REPO_ROOT / "Makefile").read_text(encoding="utf-8")
|
|
|
|
assert "kafka-manifest-summary" in script
|
|
assert "manifest_model_t_end" in script
|
|
assert "CH_MODEL_T_END=\"$(clickhouse_datetime_literal \"${manifest_model_t_end}\")\"" in script
|
|
assert "GEN_LAUNCH_PROFILE" in makefile
|
|
assert "PROFILE" in makefile
|
|
|
|
|
|
def test_generated_history_check_does_not_skip_required_live_seam():
|
|
"""Обычная проверка требует реальные live-строки после стыка."""
|
|
script = (REPO_ROOT / "scripts" / "check_generated_analytics.sh").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
makefile = (REPO_ROOT / "Makefile").read_text(encoding="utf-8")
|
|
|
|
assert 'CHECK_LIVE_SEAM="${CHECK_LIVE_SEAM:-1}"' in script
|
|
assert 'if [[ "${should_check_live_seam}" == "1" ]] && (( live_rows == 0 )); then' in script
|
|
assert "live-продолжение не записало строки" in script
|
|
assert 'CHECK_LIVE_SEAM="$${CHECK_LIVE_SEAM:-1}"' in makefile
|
|
|
|
|
|
def test_clean_generated_history_run_explicitly_skips_live_seam():
|
|
"""Чистый backfill без live-продолжения отключает проверку стыка явно."""
|
|
script = (REPO_ROOT / "scripts" / "run_generated_history_analytics.sh").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
|
|
assert "CHECK_LIVE_SEAM=0" in script
|
|
assert script.index("CHECK_LIVE_SEAM=0") < script.index('bash "${SCRIPT_DIR}/check_generated_analytics.sh"')
|
|
|
|
|
|
def test_runtime_gate_has_bounded_daily_wave_live_seam_path():
|
|
"""Runtime gate issue 17 не использует полный daily-wave на 2 суток."""
|
|
makefile = (REPO_ROOT / "Makefile").read_text(encoding="utf-8")
|
|
script = (REPO_ROOT / "scripts" / "run_generated_history_runtime_check.sh").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
|
|
assert "generated-history-runtime-check" in makefile
|
|
assert 'PROFILE="${PROFILE:-daily-wave}"' in script
|
|
assert 'GEN_HISTORY_DURATION="${GEN_HISTORY_DURATION:-1h}"' in script
|
|
assert 'LIVE_SECONDS="${LIVE_SECONDS:-25}"' in script
|
|
assert "stg_rows_after_live > stg_rows_before_live" in script
|
|
assert "GEN_RUN_MODE=live" in script
|
|
assert "GEN_STATE_RESET=false" in script
|
|
assert "up -d --build generator" in script
|
|
assert "CHECK_LIVE_SEAM=1" in script
|
|
assert "REQUIRE_SUPERSET=0" in script
|
|
|
|
|
|
def test_generated_history_check_rejects_empty_ods_context():
|
|
"""ODS-блок стыка падает, если в ODS нет строк для переходящих визитов."""
|
|
script = (REPO_ROOT / "scripts" / "check_generated_analytics.sh").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
|
|
assert "ods_device_rows" in script
|
|
assert "ods_geo_rows" in script
|
|
assert "ODS device пустой на стыке" in script
|
|
assert "ODS geo пустой на стыке" in script
|