fix(backup): bound cron backup containers
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m33s
CD Pipeline / build-and-deploy (push) Failing after 15m14s
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 1s
CD Pipeline / post-deploy-checks (push) Has been skipped
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Successful in 23s

This commit is contained in:
Your Name
2026-07-18 17:23:50 +08:00
parent f493fe8dcb
commit efe1ba0505
3 changed files with 41 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[3]
COMMON = ROOT / "scripts" / "backup" / "common.sh"
CLAWBOT = ROOT / "scripts" / "backup" / "backup-clawbot.sh"
SENTRY = ROOT / "scripts" / "backup" / "backup-sentry.sh"
def test_common_defines_bounded_container_defaults_for_cron() -> None:
source = COMMON.read_text(encoding="utf-8")
assert 'BACKUP_DOCKER_CPUS="${BACKUP_DOCKER_CPUS:-1.0}"' in source
assert 'BACKUP_DOCKER_MEMORY="${BACKUP_DOCKER_MEMORY:-1g}"' in source
assert 'BACKUP_DOCKER_MEMORY_SWAP="${BACKUP_DOCKER_MEMORY_SWAP:-1g}"' in source
def test_sentry_and_clawbot_backup_containers_use_the_bounded_contract() -> None:
common = COMMON.read_text(encoding="utf-8")
for script in (CLAWBOT, SENTRY):
source = script.read_text(encoding="utf-8")
assert 'source "$(dirname "$0")/common.sh"' in source
for variable in (
"BACKUP_DOCKER_CPUS",
"BACKUP_DOCKER_MEMORY",
"BACKUP_DOCKER_MEMORY_SWAP",
):
assert variable in common
assert variable in source
clawbot = CLAWBOT.read_text(encoding="utf-8")
assert "clawbot-v5_clawbot-redis-data:/data:ro" in clawbot