69068e2e39
部署对齐三项后端能力:启动/周期收尾僵尸批量任务、30 天推送日志 purge、已安装且版本不低于主站时跳过批量安装 Agent。 Co-authored-by: Cursor <cursoragent@cursor.com>
19 lines
548 B
Python
19 lines
548 B
Python
"""sync_logs retention purge helpers."""
|
|
|
|
from datetime import datetime, timedelta, timezone
|
|
|
|
from server.infrastructure.database.sync_log_repo import (
|
|
SYNC_LOG_PURGE_BATCH_SIZE,
|
|
SYNC_LOG_RETENTION_DAYS,
|
|
)
|
|
|
|
|
|
def test_sync_log_retention_constants():
|
|
assert SYNC_LOG_RETENTION_DAYS == 30
|
|
assert SYNC_LOG_PURGE_BATCH_SIZE >= 100
|
|
|
|
|
|
def test_purge_cutoff_is_30_days_ago():
|
|
cutoff = datetime.now(timezone.utc) - timedelta(days=SYNC_LOG_RETENTION_DAYS)
|
|
assert (datetime.now(timezone.utc) - cutoff).days == SYNC_LOG_RETENTION_DAYS
|