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

24 lines
811 B
Bash

#!/bin/bash
set -euo pipefail
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
SCRIPT="$PLUGIN_DIR/scripts/setup/mysql_upgrade.sh"
fail() {
echo "FAIL: $*" >&2
exit 1
}
grep -Fq "rollback_upgrade()" "$SCRIPT" \
|| fail "mysql_upgrade.sh does not define rollback_upgrade"
grep -Fq "UPGRADE_COMMITTED=1" "$SCRIPT" \
|| fail "mysql_upgrade.sh does not mark successful upgrades as committed"
grep -Fq 'trap '\''code=$?; rollback_upgrade "$code"'\'' EXIT' "$SCRIPT" \
|| fail "mysql_upgrade.sh does not run rollback on failed exit"
grep -Fq "RESTORED_PREVIOUS_DIR" "$SCRIPT" \
|| fail "mysql_upgrade.sh does not restore previous binary directory"
grep -Fq "RESTORED_INSTANCE_CNF" "$SCRIPT" \
|| fail "mysql_upgrade.sh does not restore previous instance config"
echo "mysql_upgrade_rollback_test: OK"