Shadow PostgreSQL promotion database preflight
This commit is contained in:
@@ -27,6 +27,7 @@ python3 ./tests/test-proxy-client-parameters.py
|
||||
./tests/test-notify-daemon-shadow.sh
|
||||
./tests/test-notify-target-shadow.sh
|
||||
./tests/test-demote-database-shadow.sh
|
||||
./tests/test-promote-database-shadow.sh
|
||||
./tests/test-demote-database-gate.sh
|
||||
./tests/test-demote-database-parameter.sh
|
||||
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
|
||||
FILE="$ROOT/ocf/loxthelion/managed-container.d/applications/postgresql/promote.sh"
|
||||
|
||||
grep -q '^mc_pg_promote_database_shadow()' "$FILE"
|
||||
grep -q '"promote.database"' "$FILE"
|
||||
grep -q 'response.get("ready") is not True' "$FILE"
|
||||
grep -q 'response.get("mutation") is not False' "$FILE"
|
||||
grep -q 'comparison=MATCH' "$FILE"
|
||||
grep -q 'promote.database shadow MISMATCH' "$FILE"
|
||||
|
||||
SHADOW_LINE="$(
|
||||
grep -n '^[[:space:]]*mc_pg_promote_database_shadow$' "$FILE" |
|
||||
tail -1 |
|
||||
cut -d: -f1
|
||||
)"
|
||||
|
||||
PROMOTE_LINE="$(
|
||||
grep -n 'exec "\$BINDIR/pg_ctl"' "$FILE" |
|
||||
head -1 |
|
||||
cut -d: -f1
|
||||
)"
|
||||
|
||||
[ -n "$SHADOW_LINE" ]
|
||||
[ -n "$PROMOTE_LINE" ]
|
||||
[ "$SHADOW_LINE" -lt "$PROMOTE_LINE" ]
|
||||
|
||||
echo "PROMOTE_DATABASE_SHADOW_TEST_PASS=1"
|
||||
Reference in New Issue
Block a user