Files
alt-mysql/tests/restore_rollback_safety_test.sh
T
2026-07-04 15:48:19 +02:00

28 lines
983 B
Bash

#!/bin/bash
set -euo pipefail
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
fail() {
echo "FAIL: $*" >&2
exit 1
}
assert_script_has_restore_rollback() {
local file="$1"
local label="$2"
grep -Fq "backup_alt_database_for_rollback" "$file" \
|| fail "$label does not create a rollback dump before overwrite"
grep -Fq "restore_alt_database_from_rollback" "$file" \
|| fail "$label does not restore rollback dump after failed import"
grep -Fq "trap cleanup_restore_rollback" "$file" \
|| fail "$label does not cleanup rollback dump"
}
assert_script_has_restore_rollback "$PLUGIN_DIR/scripts/restore_job.sh" "restore_job.sh"
assert_script_has_restore_rollback "$PLUGIN_DIR/scripts/da-integration/alt_mysql_restore_payload.sh" "alt_mysql_restore_payload.sh"
assert_script_has_restore_rollback "$PLUGIN_DIR/scripts/da-integration/da_restore_native_staging_to_alt_mysql.sh" "da_restore_native_staging_to_alt_mysql.sh"
echo "restore_rollback_safety_test: OK"