Skip to content

Commit 30df7b4

Browse files
author
Mohit Joshi
committed
Writing a new wrapper framework for executing pg_tde testcases on Jenkins
1 parent c7f348c commit 30df7b4

19 files changed

+2543
-249
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Configuration
6+
INSTALL_DIR="/home/mohit.joshi/postgresql/pg_tde/bld_18.0.1/install"
7+
PRIMARY_PORT="5432"
8+
REPLICA_PORT="5433"
9+
DB_NAME="sbtest"
10+
11+
# Track mismatch status
12+
MISMATCH_FOUND=0
13+
14+
echo "🔍 Checking row counts for tables ddl_test_1 to ddl_test_500..."
15+
16+
# Loop through table names from ddl_test_1 to ddl_test_500
17+
for i in $(seq 1 500); do
18+
TABLE="ddl_test_$i"
19+
20+
# Get row count from Primary
21+
PRIMARY_COUNT=$($INSTALL_DIR/bin/psql -p $PRIMARY_PORT -d $DB_NAME -t -c \
22+
"SELECT COUNT(*) FROM $TABLE;" | tr -d '[:space:]')
23+
24+
# Get row count from Replica
25+
REPLICA_COUNT=$($INSTALL_DIR/bin/psql -p $REPLICA_PORT -d $DB_NAME -t -c \
26+
"SELECT COUNT(*) FROM $TABLE;" | tr -d '[:space:]')
27+
28+
# Compare counts
29+
if [[ "$PRIMARY_COUNT" -ne "$REPLICA_COUNT" ]]; then
30+
echo "❌ Mismatch in table '$TABLE': Primary=$PRIMARY_COUNT, Replica=$REPLICA_COUNT"
31+
MISMATCH_FOUND=1
32+
else
33+
echo "✅ Table '$TABLE' matches: $PRIMARY_COUNT rows"
34+
fi
35+
done
36+
37+
# Exit with error if any mismatch is found
38+
if [[ "$MISMATCH_FOUND" -eq 1 ]]; then
39+
echo "🚨 Row count mismatch detected in one or more tables!"
40+
exit 1
41+
else
42+
echo "🎉 All tables match perfectly!"
43+
exit 0
44+
fi
45+

0 commit comments

Comments
 (0)