Skip to content

Commit d0da350

Browse files
committed
Add test for crosscheck of repmgr
1 parent 6ef8cec commit d0da350

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/repmgr-crosscheck/run.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
# https://github.com/paunin/PostDock/issues/225
3+
docker-compose up -d pgmaster pgslave1 pgslave3
4+
set -e
5+
6+
docker-compose exec -T pgmaster wait_local_postgres
7+
docker-compose exec -T pgslave1 wait_local_postgres
8+
docker-compose exec -T pgslave3 wait_local_postgres
9+
sleep 10
10+
11+
# Result matrix should look like this(5 rows, 3 rows with stars but with no question marks):
12+
#
13+
# Name | Id | 1 | 2 | 4
14+
# ------+----+----+----+----
15+
# node1 | 1 | * | * | *
16+
# node2 | 2 | * | * | *
17+
# node4 | 4 | * | * | *
18+
19+
for CONTAINER in "pgmaster" "pgslave1" "pgslave3"; do
20+
echo "Checking CONTAINER=$CONTAINER"
21+
UNKNOWN_NUMBER=`docker-compose exec $CONTAINER bash -c 'gosu postgres repmgr cluster crosscheck 2>/dev/null' | grep -v '?' | grep '*' | wc -l | tr -d ' '`
22+
if [[ "3" != "$UNKNOWN_NUMBER" ]]; then
23+
echo ">>> CrossCheck failed for CONTAINER=$CONTAINER (UNKNOWN_NUMBER=$UNKNOWN_NUMBER)"
24+
exit 1
25+
fi
26+
done
27+
28+
29+

0 commit comments

Comments
 (0)