feat(cookie-gate): 调度器恢复重跑接线与控制台健康自检
调度器维护循环挂载 CookieGateRecoveryManager,登录态恢复后按原业务日期自动 重跑被阻断工作流并飞书确认;工作流级 required_accounts 声明接入目录解析; 采集器抛 CookieExpiredError 退出 75;控制台新增 /api/health 自检端点与进程内 看门狗,配合 deploy/watchdog 双层保活;安装脚本同步。
This commit is contained in:
1 parent
78ea4641ce
commit
130f06b320
13 files changed
+318
-77
No files matched your search
@@ -10,9 +10,6 @@ from types import SimpleNamespace
|
||||
import pytest
|
||||
|
||||
from gyxx_flow.adapters import COOKIE_SKIP_EXIT_CODE
|
||||
from gyxx_flow.modules.content_marketing.data.tools import (
|
||||
friday_relogin_parallel as weekly_relogin,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -75,29 +72,6 @@ def _import_supply_script(module_name: str):
|
||||
sys.stderr = stderr
|
||||
|
||||
|
||||
def test_weekly_relogin_skips_the_entire_qr_workflow(
|
||||
acceptance_environment: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
capsys: pytest.CaptureFixture[str],
|
||||
) -> None:
|
||||
monkeypatch.setattr(
|
||||
weekly_relogin.subprocess,
|
||||
"Popen",
|
||||
_forbidden("acceptance mode must not launch relogin subprocesses"),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
weekly_relogin,
|
||||
"_send_lark",
|
||||
_forbidden("acceptance mode must not send QR screenshots"),
|
||||
)
|
||||
|
||||
assert weekly_relogin.main() == COOKIE_SKIP_EXIT_CODE
|
||||
assert "SKIPPED_COOKIE" in capsys.readouterr().out
|
||||
assert "content.relogin.weekly" in acceptance_environment.read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"module_name",
|
||||
[
|
||||
@@ -106,25 +80,17 @@ def test_weekly_relogin_skips_the_entire_qr_workflow(
|
||||
"batch_rescrape_bilibili",
|
||||
],
|
||||
)
|
||||
def test_batch_rescrape_relogin_never_starts_a_qr_process(
|
||||
def test_batch_rescrape_has_no_relogin_capability(
|
||||
module_name: str,
|
||||
acceptance_environment: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
capsys: pytest.CaptureFixture[str],
|
||||
) -> None:
|
||||
"""扫码重登能力已从批量补采工具中移除,登录统一由账号 vault 管理。"""
|
||||
|
||||
module = importlib.import_module(
|
||||
f"gyxx_flow.modules.content_marketing.data.tools.{module_name}"
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
module.subprocess,
|
||||
"call",
|
||||
_forbidden("acceptance mode must not invoke a relogin script"),
|
||||
)
|
||||
|
||||
assert module.do_relogin() is False
|
||||
assert "SKIPPED_COOKIE" in capsys.readouterr().out
|
||||
evidence = acceptance_environment.read_text(encoding="utf-8")
|
||||
assert f"content.{module_name}.relogin" in evidence
|
||||
assert not hasattr(module, "do_relogin")
|
||||
assert not hasattr(module, "RELOGIN_SCRIPT")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
Reference in new issue
Block a user