release: nexus btpanel session fix and app-v2
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
"""alert_logs retention purge helpers."""
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from server.infrastructure.database.alert_log_repo import (
|
||||
ALERT_LOG_PURGE_BATCH_SIZE,
|
||||
ALERT_LOG_RETENTION_DAYS,
|
||||
)
|
||||
|
||||
|
||||
def test_alert_log_retention_constants():
|
||||
assert ALERT_LOG_RETENTION_DAYS == 7
|
||||
assert ALERT_LOG_PURGE_BATCH_SIZE >= 100
|
||||
|
||||
|
||||
def test_purge_cutoff_is_7_days_ago():
|
||||
cutoff = datetime.now(timezone.utc).replace(tzinfo=None) - timedelta(
|
||||
days=ALERT_LOG_RETENTION_DAYS
|
||||
)
|
||||
age = datetime.now(timezone.utc).replace(tzinfo=None) - cutoff
|
||||
assert age.days == ALERT_LOG_RETENTION_DAYS
|
||||
Reference in New Issue
Block a user