fix(backup): deploy guarded SigNoz backup script

This commit is contained in:
ogt
2026-07-15 02:35:45 +08:00
parent 4cf66c2a7e
commit 0fb1d5aa9f
4 changed files with 16 additions and 0 deletions

View File

@@ -8,6 +8,9 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[3]
SCRIPT = ROOT / "scripts" / "backup" / "backup-signoz.sh"
DEPLOYMENT_PLAYBOOK = (
ROOT / "infra" / "ansible" / "playbooks" / "110-devops.yml"
)
def _write_executable(path: Path, text: str) -> None:
@@ -129,6 +132,14 @@ def _collector_start_count(docker_calls: list[str]) -> int:
return docker_calls.count("start signoz-otel-collector")
def test_backup_jobs_deploys_the_guarded_signoz_script() -> None:
playbook = DEPLOYMENT_PLAYBOOK.read_text(encoding="utf-8")
assert 'dest: "/backup/scripts/{{ item }}"' in playbook
assert "- backup-signoz.sh" in playbook
assert "tags: backup_jobs" in playbook
def test_collector_is_restored_once_when_backup_receives_term(tmp_path: Path) -> None:
result, docker_calls, dump_dir = _run_backup(
tmp_path,